diff --git a/config/Config-kernel.in b/config/Config-kernel.in index 07d65bc465..98dab9b6fd 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -986,6 +986,19 @@ config KERNEL_IP_MROUTE Multicast routing requires a multicast routing daemon in addition to kernel support. +if KERNEL_IP_MROUTE + + config KERNEL_IP_MROUTE_MULTIPLE_TABLES + def_bool y + + config KERNEL_IP_PIMSM_V1 + def_bool y + + config KERNEL_IP_PIMSM_V2 + def_bool y + +endif + # # IPv6 configuration # @@ -1008,8 +1021,15 @@ if KERNEL_IPV6 Multicast routing requires a multicast routing daemon in addition to kernel support. - config KERNEL_IPV6_PIMSM_V2 - def_bool n + if KERNEL_IPV6_MROUTE + + config KERNEL_IPV6_MROUTE_MULTIPLE_TABLES + def_bool y + + config KERNEL_IPV6_PIMSM_V2 + def_bool y + + endif config KERNEL_IPV6_SEG6_LWTUNNEL bool "Enable support for lightweight tunnels" diff --git a/include/kernel-version.mk b/include/kernel-version.mk index 9cd2b77e16..677693ad08 100644 --- a/include/kernel-version.mk +++ b/include/kernel-version.mk @@ -6,11 +6,11 @@ ifdef CONFIG_TESTING_KERNEL KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER) endif -LINUX_VERSION-5.4 = .169 -LINUX_VERSION-5.10 = .89 +LINUX_VERSION-5.4 = .170 +LINUX_VERSION-5.10 = .90 -LINUX_KERNEL_HASH-5.4.169 = 554382d95f71afd5f9b49292eb5d1cbe3be1a0bad22d21487c9e6d506ee01a19 -LINUX_KERNEL_HASH-5.10.89 = 92218b1a4a18f1cb9ec07d2b7fce41577452aa552c54c25b6d5fe9b4b543bb30 +LINUX_KERNEL_HASH-5.4.170 = b09f74e0cf5fc7cf5de6aa932fe654c962cb10118bdbbdddb397022c6e6d382c +LINUX_KERNEL_HASH-5.10.90 = 945e4264c014a3d9dfc0a4639309dd1ec2fb545416556421f931b95da78c2725 remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1)))) sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1))))))) diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79 index 00339dcbcc..b01a713705 100644 --- a/package/boot/uboot-envtools/files/ath79 +++ b/package/boot/uboot-envtools/files/ath79 @@ -57,6 +57,8 @@ openmesh,mr900-v2|\ openmesh,mr1750-v1|\ openmesh,mr1750-v2|\ openmesh,om5p|\ +openmesh,om5p-an|\ +openmesh,om5p-ac-v1|\ openmesh,om5p-ac-v2|\ samsung,wam250|\ ubnt,nanostation-m|\ diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index 9ad4d64ed9..d4c8424571 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -52,6 +52,7 @@ ravpower,rp-wd03) jcg,q20) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" ;; +linksys,ea6350-v4|\ linksys,ea7300-v1|\ linksys,ea7300-v2|\ linksys,ea7500-v2|\ diff --git a/package/kernel/lantiq/ltq-deu/Makefile b/package/kernel/lantiq/ltq-deu/Makefile index e5a7d0d86f..32a3b5c1b0 100644 --- a/package/kernel/lantiq/ltq-deu/Makefile +++ b/package/kernel/lantiq/ltq-deu/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=ltq-deu -PKG_RELEASE:=1 +PKG_RELEASE:=$(AUTORELEASE) PKG_MAINTAINER:=John Crispin PKG_LICENSE:=GPL-2.0+ @@ -21,7 +21,7 @@ define KernelPackage/ltq-deu-template TITLE:=deu driver for $(1) URL:=http://www.lantiq.com/ VARIANT:=$(1) - DEPENDS:=@TARGET_lantiq_$(2) +kmod-crypto-manager @LINUX_5_4 + DEPENDS:=@TARGET_lantiq_$(2) +kmod-crypto-manager +kmod-crypto-des FILES:=$(PKG_BUILD_DIR)/ltq_deu_$(1).ko AUTOLOAD:=$(call AutoProbe,ltq_deu_$(1)) endef diff --git a/package/kernel/lantiq/ltq-deu/src/Makefile b/package/kernel/lantiq/ltq-deu/src/Makefile index 93ae7ca922..13f3dccaee 100644 --- a/package/kernel/lantiq/ltq-deu/src/Makefile +++ b/package/kernel/lantiq/ltq-deu/src/Makefile @@ -7,18 +7,18 @@ endif ifeq ($(BUILD_VARIANT),ar9) CFLAGS_MODULE = -DCONFIG_AR9 -DCONFIG_CRYPTO_DEV_DEU -DCONFIG_CRYPTO_DEV_SPEED_TEST -DCONFIG_CRYPTO_DEV_DES \ - -DCONFIG_CRYPTO_DEV_AES -DCONFIG_CRYPTO_DEV_SHA1 -DCONFIG_CRYPTO_DEV_MD5 -DCONFIG_CRYPTO_DEV_ARC4 \ + -DCONFIG_CRYPTO_DEV_AES -DCONFIG_CRYPTO_DEV_SHA1 -DCONFIG_CRYPTO_DEV_MD5 \ -DCONFIG_CRYPTO_DEV_SHA1_HMAC -DCONFIG_CRYPTO_DEV_MD5_HMAC obj-m = ltq_deu_ar9.o - ltq_deu_ar9-objs = ifxmips_deu.o ifxmips_deu_ar9.o ifxmips_des.o ifxmips_aes.o ifxmips_arc4.o \ + ltq_deu_ar9-objs = ifxmips_deu.o ifxmips_deu_ar9.o ifxmips_des.o ifxmips_aes.o \ ifxmips_sha1.o ifxmips_md5.o ifxmips_sha1_hmac.o ifxmips_md5_hmac.o endif ifeq ($(BUILD_VARIANT),vr9) CFLAGS_MODULE = -DCONFIG_VR9 -DCONFIG_CRYPTO_DEV_DEU -DCONFIG_CRYPTO_DEV_SPEED_TEST -DCONFIG_CRYPTO_DEV_DES \ - -DCONFIG_CRYPTO_DEV_AES -DCONFIG_CRYPTO_DEV_SHA1 -DCONFIG_CRYPTO_DEV_MD5 -DCONFIG_CRYPTO_DEV_ARC4 \ + -DCONFIG_CRYPTO_DEV_AES -DCONFIG_CRYPTO_DEV_SHA1 -DCONFIG_CRYPTO_DEV_MD5 \ -DCONFIG_CRYPTO_DEV_SHA1_HMAC -DCONFIG_CRYPTO_DEV_MD5_HMAC obj-m = ltq_deu_vr9.o - ltq_deu_vr9-objs = ifxmips_deu.o ifxmips_deu_vr9.o ifxmips_des.o ifxmips_aes.o ifxmips_arc4.o \ + ltq_deu_vr9-objs = ifxmips_deu.o ifxmips_deu_vr9.o ifxmips_des.o ifxmips_aes.o \ ifxmips_sha1.o ifxmips_md5.o ifxmips_sha1_hmac.o ifxmips_md5_hmac.o endif diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c index 76abfafb4e..c0861a503f 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c @@ -57,6 +57,14 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include #include "ifxmips_deu.h" @@ -83,9 +91,12 @@ spinlock_t aes_lock; #define AES_MIN_KEY_SIZE 16 #define AES_MAX_KEY_SIZE 32 #define AES_BLOCK_SIZE 16 +#define AES_BLOCK_WORDS 4 #define CTR_RFC3686_NONCE_SIZE 4 #define CTR_RFC3686_IV_SIZE 8 +#define CTR_RFC3686_MIN_KEY_SIZE (AES_MIN_KEY_SIZE + CTR_RFC3686_NONCE_SIZE) #define CTR_RFC3686_MAX_KEY_SIZE (AES_MAX_KEY_SIZE + CTR_RFC3686_NONCE_SIZE) +#define AES_CBCMAC_DBN_TEMP_SIZE 128 #ifdef CRYPTO_DEBUG extern char debug_level; @@ -112,8 +123,18 @@ extern void ifx_deu_aes (void *ctx_arg, uint8_t *out_arg, const uint8_t *in_arg, struct aes_ctx { int key_length; - u32 buf[AES_MAX_KEY_SIZE]; + u8 buf[AES_MAX_KEY_SIZE]; + u8 tweakkey[AES_MAX_KEY_SIZE]; u8 nonce[CTR_RFC3686_NONCE_SIZE]; + u8 lastbuffer[4 * XTS_BLOCK_SIZE]; + int use_tweak; + u32 byte_count; + u32 dbn; + int started; + u32 (*temp)[AES_BLOCK_WORDS]; + u8 block[AES_BLOCK_SIZE]; + u8 hash[AES_BLOCK_SIZE]; + struct gf128mul_4k *gf128; }; extern int disable_deudma; @@ -130,18 +151,17 @@ extern int disable_multiblock; int aes_set_key (struct crypto_tfm *tfm, const u8 *in_key, unsigned int key_len) { struct aes_ctx *ctx = crypto_tfm_ctx(tfm); - unsigned long *flags = (unsigned long *) &tfm->crt_flags; //printk("set_key in %s\n", __FILE__); //aes_chip_init(); if (key_len != 16 && key_len != 24 && key_len != 32) { - *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; return -EINVAL; } ctx->key_length = key_len; + ctx->use_tweak = 0; DPRINTF(0, "ctx @%p, key_len %d, ctx->key_length %d\n", ctx, key_len, ctx->key_length); memcpy ((u8 *) (ctx->buf), in_key, key_len); @@ -149,35 +169,37 @@ int aes_set_key (struct crypto_tfm *tfm, const u8 *in_key, unsigned int key_len) } -/*! \fn void ifx_deu_aes (void *ctx_arg, u8 *out_arg, const u8 *in_arg, u8 *iv_arg, size_t nbytes, int encdec, int mode) +/*! \fn int aes_set_key_skcipher (struct crypto_skcipher *tfm, const uint8_t *in_key, unsigned int key_len) * \ingroup IFX_AES_FUNCTIONS - * \brief main interface to AES hardware - * \param ctx_arg crypto algo context - * \param out_arg output bytestream - * \param in_arg input bytestream - * \param iv_arg initialization vector - * \param nbytes length of bytestream - * \param encdec 1 for encrypt; 0 for decrypt - * \param mode operation mode such as ebc, cbc, ctr - * -*/ -void ifx_deu_aes (void *ctx_arg, u8 *out_arg, const u8 *in_arg, - u8 *iv_arg, size_t nbytes, int encdec, int mode) + * \brief sets the AES keys for skcipher + * \param tfm linux crypto skcipher + * \param in_key input key + * \param key_len key lengths of 16, 24 and 32 bytes supported + * \return -EINVAL - bad key length, 0 - SUCCESS +*/ +int aes_set_key_skcipher (struct crypto_skcipher *tfm, const u8 *in_key, unsigned int key_len) +{ + return aes_set_key(crypto_skcipher_tfm(tfm), in_key, key_len); +} + +/*! \fn void aes_set_key_skcipher (void *ctx_arg) + * \ingroup IFX_AES_FUNCTIONS + * \brief sets the AES key to the hardware, requires spinlock to be set by caller + * \param ctx_arg crypto algo context + * \return +*/ +void aes_set_key_hw (void *ctx_arg) { /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ volatile struct aes_t *aes = (volatile struct aes_t *) AES_START; struct aes_ctx *ctx = (struct aes_ctx *)ctx_arg; - u32 *in_key = ctx->buf; - unsigned long flag; - /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + u8 *in_key = ctx->buf; int key_len = ctx->key_length; + /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ - int i = 0; - int byte_cnt = nbytes; + if (ctx->use_tweak) in_key = ctx->tweakkey; - - CRTCL_SECT_START; /* 128, 192 or 256 bit key length */ aes->controlr.K = key_len / 8 - 2; if (key_len == 128 / 8) { @@ -206,8 +228,7 @@ void ifx_deu_aes (void *ctx_arg, u8 *out_arg, const u8 *in_arg, } else { printk (KERN_ERR "[%s %s %d]: Invalid key_len : %d\n", __FILE__, __func__, __LINE__, key_len); - CRTCL_SECT_END; - return;// -EINVAL; + return; //-EINVAL; } /* let HW pre-process DEcryption key in any case (even if @@ -215,6 +236,36 @@ void ifx_deu_aes (void *ctx_arg, u8 *out_arg, const u8 *in_arg, checked in decryption routine! */ aes->controlr.PNK = 1; +} + + +/*! \fn void ifx_deu_aes (void *ctx_arg, u8 *out_arg, const u8 *in_arg, u8 *iv_arg, size_t nbytes, int encdec, int mode) + * \ingroup IFX_AES_FUNCTIONS + * \brief main interface to AES hardware + * \param ctx_arg crypto algo context + * \param out_arg output bytestream + * \param in_arg input bytestream + * \param iv_arg initialization vector + * \param nbytes length of bytestream + * \param encdec 1 for encrypt; 0 for decrypt + * \param mode operation mode such as ebc, cbc, ctr + * +*/ +void ifx_deu_aes (void *ctx_arg, u8 *out_arg, const u8 *in_arg, + u8 *iv_arg, size_t nbytes, int encdec, int mode) + +{ + /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + volatile struct aes_t *aes = (volatile struct aes_t *) AES_START; + struct aes_ctx *ctx = (struct aes_ctx *)ctx_arg; + unsigned long flag; + /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + int i = 0; + int byte_cnt = nbytes; + + CRTCL_SECT_START; + + aes_set_key_hw (ctx_arg); aes->controlr.E_D = !encdec; //encryption aes->controlr.O = mode; //0 ECB 1 CBC 2 OFB 3 CFB 4 CTR @@ -251,23 +302,24 @@ void ifx_deu_aes (void *ctx_arg, u8 *out_arg, const u8 *in_arg, /* To handle all non-aligned bytes (not aligned to 16B size) */ if (byte_cnt) { - aes->ID3R = INPUT_ENDIAN_SWAP(*((u32 *) in_arg + (i * 4) + 0)); - aes->ID2R = INPUT_ENDIAN_SWAP(*((u32 *) in_arg + (i * 4) + 1)); - aes->ID1R = INPUT_ENDIAN_SWAP(*((u32 *) in_arg + (i * 4) + 2)); - aes->ID0R = INPUT_ENDIAN_SWAP(*((u32 *) in_arg + (i * 4) + 3)); /* start crypto */ + u8 temparea[16] = {0,}; + + memcpy(temparea, ((u32 *) in_arg + (i * 4)), byte_cnt); + + aes->ID3R = INPUT_ENDIAN_SWAP(*((u32 *) temparea + 0)); + aes->ID2R = INPUT_ENDIAN_SWAP(*((u32 *) temparea + 1)); + aes->ID1R = INPUT_ENDIAN_SWAP(*((u32 *) temparea + 2)); + aes->ID0R = INPUT_ENDIAN_SWAP(*((u32 *) temparea + 3)); /* start crypto */ while (aes->controlr.BUS) { } - *((volatile u32 *) out_arg + (i * 4) + 0) = aes->OD3R; - *((volatile u32 *) out_arg + (i * 4) + 1) = aes->OD2R; - *((volatile u32 *) out_arg + (i * 4) + 2) = aes->OD1R; - *((volatile u32 *) out_arg + (i * 4) + 3) = aes->OD0R; - - /* to ensure that the extended pages are clean */ - memset (out_arg + (i * 16) + (nbytes % AES_BLOCK_SIZE), 0, - (AES_BLOCK_SIZE - (nbytes % AES_BLOCK_SIZE))); + *((volatile u32 *) temparea + 0) = aes->OD3R; + *((volatile u32 *) temparea + 1) = aes->OD2R; + *((volatile u32 *) temparea + 2) = aes->OD1R; + *((volatile u32 *) temparea + 3) = aes->OD0R; + memcpy(((u32 *) out_arg + (i * 4)), temparea, byte_cnt); } //tc.chen : copy iv_arg back @@ -294,7 +346,6 @@ void ifx_deu_aes (void *ctx_arg, u8 *out_arg, const u8 *in_arg, int ctr_rfc3686_aes_set_key (struct crypto_tfm *tfm, const uint8_t *in_key, unsigned int key_len) { struct aes_ctx *ctx = crypto_tfm_ctx(tfm); - unsigned long *flags = (unsigned long *)&tfm->crt_flags; //printk("ctr_rfc3686_aes_set_key in %s\n", __FILE__); @@ -304,17 +355,32 @@ int ctr_rfc3686_aes_set_key (struct crypto_tfm *tfm, const uint8_t *in_key, unsi key_len -= CTR_RFC3686_NONCE_SIZE; // remove 4 bytes of nonce if (key_len != 16 && key_len != 24 && key_len != 32) { - *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; return -EINVAL; } ctx->key_length = key_len; + ctx->use_tweak = 0; memcpy ((u8 *) (ctx->buf), in_key, key_len); return 0; } +/*! + * \fn int ctr_rfc3686_aes_set_key_skcipher (struct crypto_skcipher *tfm, const uint8_t *in_key, unsigned int key_len) + * \ingroup IFX_AES_FUNCTIONS + * \brief sets RFC3686 key for skcipher + * \param tfm linux crypto skcipher + * \param in_key input key + * \param key_len key lengths of 20, 28 and 36 bytes supported; last 4 bytes is nonce + * \return 0 - SUCCESS + * -EINVAL - bad key length +*/ +int ctr_rfc3686_aes_set_key_skcipher (struct crypto_skcipher *tfm, const uint8_t *in_key, unsigned int key_len) +{ + return ctr_rfc3686_aes_set_key(crypto_skcipher_tfm(tfm), in_key, key_len); +} + /*! \fn void ifx_deu_aes (void *ctx_arg, u8 *out_arg, const u8 *in_arg, u8 *iv_arg, u32 nbytes, int encdec, int mode) * \ingroup IFX_AES_FUNCTIONS * \brief main interface with deu hardware in DMA mode @@ -423,11 +489,11 @@ void ifx_deu_aes_ctr (void *ctx, uint8_t *dst, const uint8_t *src, /*! \fn void aes_encrypt (struct crypto_tfm *tfm, uint8_t *out, const uint8_t *in) * \ingroup IFX_AES_FUNCTIONS - * \brief encrypt AES_BLOCK_SIZE of data - * \param tfm linux crypto algo transform - * \param out output bytestream - * \param in input bytestream -*/ + * \brief encrypt AES_BLOCK_SIZE of data + * \param tfm linux crypto algo transform + * \param out output bytestream + * \param in input bytestream +*/ void aes_encrypt (struct crypto_tfm *tfm, uint8_t *out, const uint8_t *in) { struct aes_ctx *ctx = crypto_tfm_ctx(tfm); @@ -437,11 +503,11 @@ void aes_encrypt (struct crypto_tfm *tfm, uint8_t *out, const uint8_t *in) /*! \fn void aes_decrypt (struct crypto_tfm *tfm, uint8_t *out, const uint8_t *in) * \ingroup IFX_AES_FUNCTIONS - * \brief decrypt AES_BLOCK_SIZE of data - * \param tfm linux crypto algo transform - * \param out output bytestream - * \param in input bytestream -*/ + * \brief decrypt AES_BLOCK_SIZE of data + * \param tfm linux crypto algo transform + * \param out output bytestream + * \param in input bytestream +*/ void aes_decrypt (struct crypto_tfm *tfm, uint8_t *out, const uint8_t *in) { struct aes_ctx *ctx = crypto_tfm_ctx(tfm); @@ -449,14 +515,14 @@ void aes_decrypt (struct crypto_tfm *tfm, uint8_t *out, const uint8_t *in) CRYPTO_DIR_DECRYPT, 0); } -/* - * \brief AES function mappings +/* + * \brief AES function mappings */ struct crypto_alg ifxdeu_aes_alg = { .cra_name = "aes", .cra_driver_name = "ifxdeu-aes", .cra_priority = 300, - .cra_flags = CRYPTO_ALG_TYPE_CIPHER, + .cra_flags = CRYPTO_ALG_TYPE_CIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY, .cra_blocksize = AES_BLOCK_SIZE, .cra_ctxsize = sizeof(struct aes_ctx), .cra_module = THIS_MODULE, @@ -472,156 +538,53 @@ struct crypto_alg ifxdeu_aes_alg = { } }; -/*! \fn int ecb_aes_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) +/*! \fn int ecb_aes_encrypt(struct skcipher_req *req) * \ingroup IFX_AES_FUNCTIONS - * \brief ECB AES encrypt using linux crypto blkcipher - * \param desc blkcipher descriptor - * \param dst output scatterlist - * \param src input scatterlist - * \param nbytes data size in bytes + * \brief ECB AES encrypt using linux crypto skcipher + * \param req skcipher request * \return err -*/ -int ecb_aes_encrypt(struct blkcipher_desc *desc, - struct scatterlist *dst, struct scatterlist *src, - unsigned int nbytes) +*/ +int ecb_aes_encrypt(struct skcipher_request *req) { - struct aes_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - struct blkcipher_walk walk; + struct aes_ctx *ctx = crypto_tfm_ctx(req->base.tfm); + struct skcipher_walk walk; int err; - unsigned int enc_bytes; - - blkcipher_walk_init(&walk, dst, src, nbytes); - err = blkcipher_walk_virt(desc, &walk); + unsigned int enc_bytes, nbytes; + + err = skcipher_walk_virt(&walk, req, false); while ((nbytes = enc_bytes = walk.nbytes)) { enc_bytes -= (nbytes % AES_BLOCK_SIZE); ifx_deu_aes_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr, NULL, enc_bytes, CRYPTO_DIR_ENCRYPT, 0); nbytes &= AES_BLOCK_SIZE - 1; - err = blkcipher_walk_done(desc, &walk, nbytes); + err = skcipher_walk_done(&walk, nbytes); } return err; } -/*! \fn int ecb_aes_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) +/*! \fn int ecb_aes_decrypt(struct skcipher_req *req) * \ingroup IFX_AES_FUNCTIONS - * \brief ECB AES decrypt using linux crypto blkcipher - * \param desc blkcipher descriptor - * \param dst output scatterlist - * \param src input scatterlist - * \param nbytes data size in bytes + * \brief ECB AES decrypt using linux crypto skcipher + * \param req skcipher request * \return err -*/ -int ecb_aes_decrypt(struct blkcipher_desc *desc, - struct scatterlist *dst, struct scatterlist *src, - unsigned int nbytes) +*/ +int ecb_aes_decrypt(struct skcipher_request *req) { - struct aes_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - struct blkcipher_walk walk; + struct aes_ctx *ctx = crypto_tfm_ctx(req->base.tfm); + struct skcipher_walk walk; int err; - unsigned int dec_bytes; + unsigned int dec_bytes, nbytes; - blkcipher_walk_init(&walk, dst, src, nbytes); - err = blkcipher_walk_virt(desc, &walk); + err = skcipher_walk_virt(&walk, req, false); while ((nbytes = dec_bytes = walk.nbytes)) { dec_bytes -= (nbytes % AES_BLOCK_SIZE); ifx_deu_aes_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr, NULL, dec_bytes, CRYPTO_DIR_DECRYPT, 0); nbytes &= AES_BLOCK_SIZE - 1; - err = blkcipher_walk_done(desc, &walk, nbytes); - } - - return err; -} - -/* - * \brief AES function mappings -*/ -struct crypto_alg ifxdeu_ecb_aes_alg = { - .cra_name = "ecb(aes)", - .cra_driver_name = "ifxdeu-ecb(aes)", - .cra_priority = 400, - .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, - .cra_blocksize = AES_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct aes_ctx), - .cra_type = &crypto_blkcipher_type, - .cra_module = THIS_MODULE, - .cra_list = LIST_HEAD_INIT(ifxdeu_ecb_aes_alg.cra_list), - .cra_u = { - .blkcipher = { - .min_keysize = AES_MIN_KEY_SIZE, - .max_keysize = AES_MAX_KEY_SIZE, - .setkey = aes_set_key, - .encrypt = ecb_aes_encrypt, - .decrypt = ecb_aes_decrypt, - } - } -}; - - -/*! \fn int cbc_aes_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) - * \ingroup IFX_AES_FUNCTIONS - * \brief CBC AES encrypt using linux crypto blkcipher - * \param desc blkcipher descriptor - * \param dst output scatterlist - * \param src input scatterlist - * \param nbytes data size in bytes - * \return err -*/ -int cbc_aes_encrypt(struct blkcipher_desc *desc, - struct scatterlist *dst, struct scatterlist *src, - unsigned int nbytes) -{ - struct aes_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - struct blkcipher_walk walk; - int err; - unsigned int enc_bytes; - - blkcipher_walk_init(&walk, dst, src, nbytes); - err = blkcipher_walk_virt(desc, &walk); - - while ((nbytes = enc_bytes = walk.nbytes)) { - u8 *iv = walk.iv; - enc_bytes -= (nbytes % AES_BLOCK_SIZE); - ifx_deu_aes_cbc(ctx, walk.dst.virt.addr, walk.src.virt.addr, - iv, enc_bytes, CRYPTO_DIR_ENCRYPT, 0); - nbytes &= AES_BLOCK_SIZE - 1; - err = blkcipher_walk_done(desc, &walk, nbytes); - } - - return err; -} - -/*! \fn int cbc_aes_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) - * \ingroup IFX_AES_FUNCTIONS - * \brief CBC AES decrypt using linux crypto blkcipher - * \param desc blkcipher descriptor - * \param dst output scatterlist - * \param src input scatterlist - * \param nbytes data size in bytes - * \return err -*/ -int cbc_aes_decrypt(struct blkcipher_desc *desc, - struct scatterlist *dst, struct scatterlist *src, - unsigned int nbytes) -{ - struct aes_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - struct blkcipher_walk walk; - int err; - unsigned int dec_bytes; - - blkcipher_walk_init(&walk, dst, src, nbytes); - err = blkcipher_walk_virt(desc, &walk); - - while ((nbytes = dec_bytes = walk.nbytes)) { - u8 *iv = walk.iv; - dec_bytes -= (nbytes % AES_BLOCK_SIZE); - ifx_deu_aes_cbc(ctx, walk.dst.virt.addr, walk.src.virt.addr, - iv, dec_bytes, CRYPTO_DIR_DECRYPT, 0); - nbytes &= AES_BLOCK_SIZE - 1; - err = blkcipher_walk_done(desc, &walk, nbytes); + err = skcipher_walk_done(&walk, nbytes); } return err; @@ -630,198 +593,644 @@ int cbc_aes_decrypt(struct blkcipher_desc *desc, /* * \brief AES function mappings */ -struct crypto_alg ifxdeu_cbc_aes_alg = { - .cra_name = "cbc(aes)", - .cra_driver_name = "ifxdeu-cbc(aes)", - .cra_priority = 400, - .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, - .cra_blocksize = AES_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct aes_ctx), - .cra_type = &crypto_blkcipher_type, - .cra_module = THIS_MODULE, - .cra_list = LIST_HEAD_INIT(ifxdeu_cbc_aes_alg.cra_list), - .cra_u = { - .blkcipher = { - .min_keysize = AES_MIN_KEY_SIZE, - .max_keysize = AES_MAX_KEY_SIZE, - .ivsize = AES_BLOCK_SIZE, - .setkey = aes_set_key, - .encrypt = cbc_aes_encrypt, - .decrypt = cbc_aes_decrypt, - } - } +struct skcipher_alg ifxdeu_ecb_aes_alg = { + .base.cra_name = "ecb(aes)", + .base.cra_driver_name = "ifxdeu-ecb(aes)", + .base.cra_priority = 400, + .base.cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY, + .base.cra_blocksize = AES_BLOCK_SIZE, + .base.cra_ctxsize = sizeof(struct aes_ctx), + .base.cra_module = THIS_MODULE, + .base.cra_list = LIST_HEAD_INIT(ifxdeu_ecb_aes_alg.base.cra_list), + .min_keysize = AES_MIN_KEY_SIZE, + .max_keysize = AES_MAX_KEY_SIZE, + .setkey = aes_set_key_skcipher, + .encrypt = ecb_aes_encrypt, + .decrypt = ecb_aes_decrypt, }; - -/*! \fn int ctr_basic_aes_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) +/*! \fn int ecb_aes_encrypt(struct skcipher_req *req) * \ingroup IFX_AES_FUNCTIONS - * \brief Counter mode AES encrypt using linux crypto blkcipher - * \param desc blkcipher descriptor - * \param dst output scatterlist - * \param src input scatterlist - * \param nbytes data size in bytes + * \brief CBC AES encrypt using linux crypto skcipher + * \param req skcipher request * \return err -*/ -int ctr_basic_aes_encrypt(struct blkcipher_desc *desc, - struct scatterlist *dst, struct scatterlist *src, - unsigned int nbytes) +*/ +int cbc_aes_encrypt(struct skcipher_request *req) { - struct aes_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - struct blkcipher_walk walk; + struct aes_ctx *ctx = crypto_tfm_ctx(req->base.tfm); + struct skcipher_walk walk; int err; - unsigned int enc_bytes; + unsigned int enc_bytes, nbytes; - blkcipher_walk_init(&walk, dst, src, nbytes); - err = blkcipher_walk_virt(desc, &walk); + err = skcipher_walk_virt(&walk, req, false); while ((nbytes = enc_bytes = walk.nbytes)) { u8 *iv = walk.iv; enc_bytes -= (nbytes % AES_BLOCK_SIZE); - ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr, + ifx_deu_aes_cbc(ctx, walk.dst.virt.addr, walk.src.virt.addr, iv, enc_bytes, CRYPTO_DIR_ENCRYPT, 0); nbytes &= AES_BLOCK_SIZE - 1; - err = blkcipher_walk_done(desc, &walk, nbytes); + err = skcipher_walk_done(&walk, nbytes); } return err; } -/*! \fn int ctr_basic_aes_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) +/*! \fn int cbc_aes_decrypt(struct skcipher_req *req) * \ingroup IFX_AES_FUNCTIONS - * \brief Counter mode AES decrypt using linux crypto blkcipher - * \param desc blkcipher descriptor - * \param dst output scatterlist - * \param src input scatterlist - * \param nbytes data size in bytes + * \brief CBC AES decrypt using linux crypto skcipher + * \param req skcipher request * \return err -*/ -int ctr_basic_aes_decrypt(struct blkcipher_desc *desc, - struct scatterlist *dst, struct scatterlist *src, - unsigned int nbytes) +*/ +int cbc_aes_decrypt(struct skcipher_request *req) { - struct aes_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - struct blkcipher_walk walk; + struct aes_ctx *ctx = crypto_tfm_ctx(req->base.tfm); + struct skcipher_walk walk; int err; - unsigned int dec_bytes; + unsigned int dec_bytes, nbytes; - blkcipher_walk_init(&walk, dst, src, nbytes); - err = blkcipher_walk_virt(desc, &walk); + err = skcipher_walk_virt(&walk, req, false); while ((nbytes = dec_bytes = walk.nbytes)) { u8 *iv = walk.iv; dec_bytes -= (nbytes % AES_BLOCK_SIZE); - ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr, + ifx_deu_aes_cbc(ctx, walk.dst.virt.addr, walk.src.virt.addr, iv, dec_bytes, CRYPTO_DIR_DECRYPT, 0); nbytes &= AES_BLOCK_SIZE - 1; - err = blkcipher_walk_done(desc, &walk, nbytes); + err = skcipher_walk_done(&walk, nbytes); } return err; } -/* +/* * \brief AES function mappings */ -struct crypto_alg ifxdeu_ctr_basic_aes_alg = { - .cra_name = "ctr(aes)", - .cra_driver_name = "ifxdeu-ctr(aes)", - .cra_priority = 400, - .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, - .cra_blocksize = AES_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct aes_ctx), - .cra_type = &crypto_blkcipher_type, - .cra_module = THIS_MODULE, - .cra_list = LIST_HEAD_INIT(ifxdeu_ctr_basic_aes_alg.cra_list), - .cra_u = { - .blkcipher = { - .min_keysize = AES_MIN_KEY_SIZE, - .max_keysize = AES_MAX_KEY_SIZE, - .ivsize = AES_BLOCK_SIZE, - .setkey = aes_set_key, - .encrypt = ctr_basic_aes_encrypt, - .decrypt = ctr_basic_aes_decrypt, - } - } +struct skcipher_alg ifxdeu_cbc_aes_alg = { + .base.cra_name = "cbc(aes)", + .base.cra_driver_name = "ifxdeu-cbc(aes)", + .base.cra_priority = 400, + .base.cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY, + .base.cra_blocksize = AES_BLOCK_SIZE, + .base.cra_ctxsize = sizeof(struct aes_ctx), + .base.cra_module = THIS_MODULE, + .base.cra_list = LIST_HEAD_INIT(ifxdeu_cbc_aes_alg.base.cra_list), + .min_keysize = AES_MIN_KEY_SIZE, + .max_keysize = AES_MAX_KEY_SIZE, + .ivsize = AES_BLOCK_SIZE, + .setkey = aes_set_key_skcipher, + .encrypt = cbc_aes_encrypt, + .decrypt = cbc_aes_decrypt, }; - -/*! \fn int ctr_rfc3686_aes_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) +/*! \fn void ifx_deu_aes_xts (void *ctx_arg, u8 *out_arg, const u8 *in_arg, u8 *iv_arg, size_t nbytes, int encdec) * \ingroup IFX_AES_FUNCTIONS - * \brief Counter mode AES (rfc3686) encrypt using linux crypto blkcipher - * \param desc blkcipher descriptor - * \param dst output scatterlist - * \param src input scatterlist - * \param nbytes data size in bytes - * \return err -*/ -int ctr_rfc3686_aes_encrypt(struct blkcipher_desc *desc, - struct scatterlist *dst, struct scatterlist *src, - unsigned int nbytes) + * \brief main interface to AES hardware for XTS impl + * \param ctx_arg crypto algo context + * \param out_arg output bytestream + * \param in_arg input bytestream + * \param iv_arg initialization vector + * \param nbytes length of bytestream + * \param encdec 1 for encrypt; 0 for decrypt + * +*/ +void ifx_deu_aes_xts (void *ctx_arg, u8 *out_arg, const u8 *in_arg, + u8 *iv_arg, size_t nbytes, int encdec) { - struct aes_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - struct blkcipher_walk walk; - int err, bsize = nbytes; - u8 rfc3686_iv[16]; + /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + volatile struct aes_t *aes = (volatile struct aes_t *) AES_START; + struct aes_ctx *ctx = (struct aes_ctx *)ctx_arg; + unsigned long flag; + /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + u8 oldiv[16]; + int i = 0; + int byte_cnt = nbytes; - blkcipher_walk_init(&walk, dst, src, nbytes); - err = blkcipher_walk_virt(desc, &walk); - - /* set up counter block */ - memcpy(rfc3686_iv, ctx->nonce, CTR_RFC3686_NONCE_SIZE); - memcpy(rfc3686_iv + CTR_RFC3686_NONCE_SIZE, walk.iv, CTR_RFC3686_IV_SIZE); + CRTCL_SECT_START; - /* initialize counter portion of counter block */ - *(__be32 *)(rfc3686_iv + CTR_RFC3686_NONCE_SIZE + CTR_RFC3686_IV_SIZE) = - cpu_to_be32(1); + aes_set_key_hw (ctx_arg); - /* scatterlist source is the same size as request size, just process once */ - if (nbytes == walk.nbytes) { - ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr, - rfc3686_iv, nbytes, CRYPTO_DIR_ENCRYPT, 0); - nbytes -= walk.nbytes; - err = blkcipher_walk_done(desc, &walk, nbytes); - return err; + aes->controlr.E_D = !encdec; //encryption + aes->controlr.O = 1; //0 ECB 1 CBC 2 OFB 3 CFB 4 CTR - CBC mode for xts + + i = 0; + while (byte_cnt >= 16) { + + if (!encdec) { + if (((byte_cnt % 16) > 0) && (byte_cnt < (2*XTS_BLOCK_SIZE))) { + memcpy(oldiv, iv_arg, 16); + gf128mul_x_ble((le128 *)iv_arg, (le128 *)iv_arg); + } + u128_xor((u128 *)((u32 *) in_arg + (i * 4) + 0), (u128 *)((u32 *) in_arg + (i * 4) + 0), (u128 *)iv_arg); + } + + aes->IV3R = DEU_ENDIAN_SWAP(*(u32 *) iv_arg); + aes->IV2R = DEU_ENDIAN_SWAP(*((u32 *) iv_arg + 1)); + aes->IV1R = DEU_ENDIAN_SWAP(*((u32 *) iv_arg + 2)); + aes->IV0R = DEU_ENDIAN_SWAP(*((u32 *) iv_arg + 3)); + + aes->ID3R = INPUT_ENDIAN_SWAP(*((u32 *) in_arg + (i * 4) + 0)); + aes->ID2R = INPUT_ENDIAN_SWAP(*((u32 *) in_arg + (i * 4) + 1)); + aes->ID1R = INPUT_ENDIAN_SWAP(*((u32 *) in_arg + (i * 4) + 2)); + aes->ID0R = INPUT_ENDIAN_SWAP(*((u32 *) in_arg + (i * 4) + 3)); /* start crypto */ + + while (aes->controlr.BUS) { + // this will not take long + } + + *((volatile u32 *) out_arg + (i * 4) + 0) = aes->OD3R; + *((volatile u32 *) out_arg + (i * 4) + 1) = aes->OD2R; + *((volatile u32 *) out_arg + (i * 4) + 2) = aes->OD1R; + *((volatile u32 *) out_arg + (i * 4) + 3) = aes->OD0R; + + if (encdec) { + u128_xor((u128 *)((volatile u32 *) out_arg + (i * 4) + 0), (u128 *)((volatile u32 *) out_arg + (i * 4) + 0), (u128 *)iv_arg); + } + gf128mul_x_ble((le128 *)iv_arg, (le128 *)iv_arg); + i++; + byte_cnt -= 16; } - while ((nbytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) { - ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr, - rfc3686_iv, nbytes, CRYPTO_DIR_ENCRYPT, 0); + if (byte_cnt) { + u8 state[XTS_BLOCK_SIZE] = {0,}; - nbytes -= walk.nbytes; - bsize -= walk.nbytes; - err = blkcipher_walk_done(desc, &walk, nbytes); + if (!encdec) memcpy(iv_arg, oldiv, 16); + + aes->IV3R = DEU_ENDIAN_SWAP(*(u32 *) iv_arg); + aes->IV2R = DEU_ENDIAN_SWAP(*((u32 *) iv_arg + 1)); + aes->IV1R = DEU_ENDIAN_SWAP(*((u32 *) iv_arg + 2)); + aes->IV0R = DEU_ENDIAN_SWAP(*((u32 *) iv_arg + 3)); + + memcpy(state, ((u32 *) in_arg + (i * 4) + 0), byte_cnt); + memcpy((state + byte_cnt), (out_arg + ((i - 1) * 16) + byte_cnt), (XTS_BLOCK_SIZE - byte_cnt)); + if (!encdec) { + u128_xor((u128 *)state, (u128 *)state, (u128 *)iv_arg); + } + + aes->ID3R = INPUT_ENDIAN_SWAP(*((u32 *) state + 0)); + aes->ID2R = INPUT_ENDIAN_SWAP(*((u32 *) state + 1)); + aes->ID1R = INPUT_ENDIAN_SWAP(*((u32 *) state + 2)); + aes->ID0R = INPUT_ENDIAN_SWAP(*((u32 *) state + 3)); /* start crypto */ + + memcpy(((u32 *) out_arg + (i * 4) + 0), ((u32 *) out_arg + ((i - 1) * 4) + 0), byte_cnt); + + while (aes->controlr.BUS) { + // this will not take long + } + + *((volatile u32 *) out_arg + ((i-1) * 4) + 0) = aes->OD3R; + *((volatile u32 *) out_arg + ((i-1) * 4) + 1) = aes->OD2R; + *((volatile u32 *) out_arg + ((i-1) * 4) + 2) = aes->OD1R; + *((volatile u32 *) out_arg + ((i-1) * 4) + 3) = aes->OD0R; + + if (encdec) { + u128_xor((u128 *)((volatile u32 *) out_arg + ((i-1) * 4) + 0), (u128 *)((volatile u32 *) out_arg + ((i-1) * 4) + 0), (u128 *)iv_arg); + } + } + + CRTCL_SECT_END; +} + +/*! \fn int xts_aes_encrypt(struct skcipher_req *req) + * \ingroup IFX_AES_FUNCTIONS + * \brief XTS AES encrypt using linux crypto skcipher + * \param req skcipher request + * \return err +*/ +int xts_aes_encrypt(struct skcipher_request *req) +{ + struct aes_ctx *ctx = crypto_tfm_ctx(req->base.tfm); + struct skcipher_walk walk; + int err; + unsigned int enc_bytes, nbytes, processed; + + err = skcipher_walk_virt(&walk, req, false); + + if (req->cryptlen < XTS_BLOCK_SIZE) + return -EINVAL; + + ctx->use_tweak = 1; + aes_encrypt(req->base.tfm, walk.iv, walk.iv); + ctx->use_tweak = 0; + processed = 0; + + while ((nbytes = walk.nbytes) && (walk.nbytes >= (XTS_BLOCK_SIZE * 2)) ) { + u8 *iv = walk.iv; + if (nbytes == walk.total) { + enc_bytes = nbytes; + } else { + enc_bytes = nbytes & ~(XTS_BLOCK_SIZE - 1); + if ((req->cryptlen - processed - enc_bytes) < (XTS_BLOCK_SIZE)) { + if (enc_bytes > (2 * XTS_BLOCK_SIZE)) { + enc_bytes -= XTS_BLOCK_SIZE; + } else { + break; + } + } + } + ifx_deu_aes_xts(ctx, walk.dst.virt.addr, walk.src.virt.addr, + iv, enc_bytes, CRYPTO_DIR_ENCRYPT); + err = skcipher_walk_done(&walk, nbytes - enc_bytes); + processed += enc_bytes; + } + + if ((walk.nbytes)) { + u8 *iv = walk.iv; + nbytes = req->cryptlen - processed; + scatterwalk_map_and_copy(ctx->lastbuffer, req->src, (req->cryptlen - nbytes), nbytes, 0); + ifx_deu_aes_xts(ctx, ctx->lastbuffer, ctx->lastbuffer, + iv, nbytes, CRYPTO_DIR_ENCRYPT); + scatterwalk_map_and_copy(ctx->lastbuffer, req->dst, (req->cryptlen - nbytes), nbytes, 1); + skcipher_request_complete(req, 0); + } + + return err; +} + +/*! \fn int xts_aes_decrypt(struct skcipher_req *req) + * \ingroup IFX_AES_FUNCTIONS + * \brief XTS AES decrypt using linux crypto skcipher + * \param req skcipher request + * \return err +*/ +int xts_aes_decrypt(struct skcipher_request *req) +{ + struct aes_ctx *ctx = crypto_tfm_ctx(req->base.tfm); + struct skcipher_walk walk; + int err; + unsigned int dec_bytes, nbytes, processed; + + err = skcipher_walk_virt(&walk, req, false); + + if (req->cryptlen < XTS_BLOCK_SIZE) + return -EINVAL; + + ctx->use_tweak = 1; + aes_encrypt(req->base.tfm, walk.iv, walk.iv); + ctx->use_tweak = 0; + processed = 0; + + while ((nbytes = walk.nbytes) && (walk.nbytes >= (XTS_BLOCK_SIZE * 2))) { + u8 *iv = walk.iv; + if (nbytes == walk.total) { + dec_bytes = nbytes; + } else { + dec_bytes = nbytes & ~(XTS_BLOCK_SIZE - 1); + if ((req->cryptlen - processed - dec_bytes) < (XTS_BLOCK_SIZE)) { + if (dec_bytes > (2 * XTS_BLOCK_SIZE)) { + dec_bytes -= XTS_BLOCK_SIZE; + } else { + break; + } + } + } + ifx_deu_aes_xts(ctx, walk.dst.virt.addr, walk.src.virt.addr, + iv, dec_bytes, CRYPTO_DIR_DECRYPT); + err = skcipher_walk_done(&walk, nbytes - dec_bytes); + processed += dec_bytes; + } + + if ((walk.nbytes)) { + u8 *iv = walk.iv; + nbytes = req->cryptlen - processed; + scatterwalk_map_and_copy(ctx->lastbuffer, req->src, (req->cryptlen - nbytes), nbytes, 0); + ifx_deu_aes_xts(ctx, ctx->lastbuffer, ctx->lastbuffer, + iv, nbytes, CRYPTO_DIR_DECRYPT); + scatterwalk_map_and_copy(ctx->lastbuffer, req->dst, (req->cryptlen - nbytes), nbytes, 1); + skcipher_request_complete(req, 0); + } + + return err; +} + +/*! \fn int xts_aes_set_key_skcipher (struct crypto_tfm *tfm, const uint8_t *in_key, unsigned int key_len) + * \ingroup IFX_AES_FUNCTIONS + * \brief sets the AES keys for XTS + * \param tfm linux crypto algo transform + * \param in_key input key + * \param key_len key lengths of 16, 24 and 32 bytes supported + * \return -EINVAL - bad key length, 0 - SUCCESS +*/ +int xts_aes_set_key_skcipher (struct crypto_skcipher *tfm, const u8 *in_key, unsigned int key_len) +{ + struct aes_ctx *ctx = crypto_tfm_ctx(crypto_skcipher_tfm(tfm)); + unsigned int keylen = (key_len / 2); + + if (key_len % 2) return -EINVAL; + + if (keylen != 16 && keylen != 24 && keylen != 32) { + return -EINVAL; + } + + ctx->key_length = keylen; + ctx->use_tweak = 0; + DPRINTF(0, "ctx @%p, key_len %d, ctx->key_length %d\n", ctx, key_len, ctx->key_length); + memcpy ((u8 *) (ctx->buf), in_key, keylen); + memcpy ((u8 *) (ctx->tweakkey), in_key + keylen, keylen); + + return 0; +} + +/* + * \brief AES function mappings +*/ +struct skcipher_alg ifxdeu_xts_aes_alg = { + .base.cra_name = "xts(aes)", + .base.cra_driver_name = "ifxdeu-xts(aes)", + .base.cra_priority = 400, + .base.cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY, + .base.cra_blocksize = XTS_BLOCK_SIZE, + .base.cra_ctxsize = sizeof(struct aes_ctx), + .base.cra_module = THIS_MODULE, + .base.cra_list = LIST_HEAD_INIT(ifxdeu_xts_aes_alg.base.cra_list), + .min_keysize = AES_MIN_KEY_SIZE * 2, + .max_keysize = AES_MAX_KEY_SIZE * 2, + .ivsize = XTS_BLOCK_SIZE, + .walksize = 2 * XTS_BLOCK_SIZE, + .setkey = xts_aes_set_key_skcipher, + .encrypt = xts_aes_encrypt, + .decrypt = xts_aes_decrypt, +}; + +/*! \fn int ofb_aes_encrypt(struct skcipher_req *req) + * \ingroup IFX_AES_FUNCTIONS + * \brief OFB AES encrypt using linux crypto skcipher + * \param req skcipher request + * \return err +*/ +int ofb_aes_encrypt(struct skcipher_request *req) +{ + struct aes_ctx *ctx = crypto_tfm_ctx(req->base.tfm); + struct skcipher_walk walk; + int err; + unsigned int enc_bytes, nbytes; + + err = skcipher_walk_virt(&walk, req, false); + + while ((nbytes = enc_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) { + enc_bytes -= (nbytes % AES_BLOCK_SIZE); + ifx_deu_aes_ofb(ctx, walk.dst.virt.addr, walk.src.virt.addr, + walk.iv, enc_bytes, CRYPTO_DIR_ENCRYPT, 0); + nbytes &= AES_BLOCK_SIZE - 1; + err = skcipher_walk_done(&walk, nbytes); } /* to handle remaining bytes < AES_BLOCK_SIZE */ if (walk.nbytes) { - ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr, - rfc3686_iv, walk.nbytes, CRYPTO_DIR_ENCRYPT, 0); - err = blkcipher_walk_done(desc, &walk, 0); + ifx_deu_aes_ofb(ctx, walk.dst.virt.addr, walk.src.virt.addr, + walk.iv, walk.nbytes, CRYPTO_DIR_ENCRYPT, 0); + err = skcipher_walk_done(&walk, 0); } - + return err; } -/*! \fn int ctr_rfc3686_aes_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) +/*! \fn int ofb_aes_decrypt(struct skcipher_req *req) * \ingroup IFX_AES_FUNCTIONS - * \brief Counter mode AES (rfc3686) decrypt using linux crypto blkcipher - * \param desc blkcipher descriptor - * \param dst output scatterlist - * \param src input scatterlist - * \param nbytes data size in bytes + * \brief OFB AES decrypt using linux crypto skcipher + * \param req skcipher request * \return err -*/ -int ctr_rfc3686_aes_decrypt(struct blkcipher_desc *desc, - struct scatterlist *dst, struct scatterlist *src, - unsigned int nbytes) +*/ +int ofb_aes_decrypt(struct skcipher_request *req) { - struct aes_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - struct blkcipher_walk walk; - int err, bsize = nbytes; + struct aes_ctx *ctx = crypto_tfm_ctx(req->base.tfm); + struct skcipher_walk walk; + int err; + unsigned int dec_bytes, nbytes; + + err = skcipher_walk_virt(&walk, req, false); + + while ((nbytes = dec_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) { + dec_bytes -= (nbytes % AES_BLOCK_SIZE); + ifx_deu_aes_ofb(ctx, walk.dst.virt.addr, walk.src.virt.addr, + walk.iv, dec_bytes, CRYPTO_DIR_DECRYPT, 0); + nbytes &= AES_BLOCK_SIZE - 1; + err = skcipher_walk_done(&walk, nbytes); + } + + /* to handle remaining bytes < AES_BLOCK_SIZE */ + if (walk.nbytes) { + ifx_deu_aes_ofb(ctx, walk.dst.virt.addr, walk.src.virt.addr, + walk.iv, walk.nbytes, CRYPTO_DIR_DECRYPT, 0); + err = skcipher_walk_done(&walk, 0); + } + + return err; +} + +/* + * \brief AES function mappings +*/ +struct skcipher_alg ifxdeu_ofb_aes_alg = { + .base.cra_name = "ofb(aes)", + .base.cra_driver_name = "ifxdeu-ofb(aes)", + .base.cra_priority = 400, + .base.cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY, + .base.cra_blocksize = 1, + .base.cra_ctxsize = sizeof(struct aes_ctx), + .base.cra_module = THIS_MODULE, + .base.cra_list = LIST_HEAD_INIT(ifxdeu_ofb_aes_alg.base.cra_list), + .min_keysize = AES_MIN_KEY_SIZE, + .max_keysize = AES_MAX_KEY_SIZE, + .ivsize = AES_BLOCK_SIZE, + .chunksize = AES_BLOCK_SIZE, + .walksize = AES_BLOCK_SIZE, + .setkey = aes_set_key_skcipher, + .encrypt = ofb_aes_encrypt, + .decrypt = ofb_aes_decrypt, +}; + +/*! \fn int cfb_aes_encrypt(struct skcipher_req *req) + * \ingroup IFX_AES_FUNCTIONS + * \brief CFB AES encrypt using linux crypto skcipher + * \param req skcipher request + * \return err +*/ +int cfb_aes_encrypt(struct skcipher_request *req) +{ + struct aes_ctx *ctx = crypto_tfm_ctx(req->base.tfm); + struct skcipher_walk walk; + int err; + unsigned int enc_bytes, nbytes; + + err = skcipher_walk_virt(&walk, req, false); + + while ((nbytes = enc_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) { + enc_bytes -= (nbytes % AES_BLOCK_SIZE); + ifx_deu_aes_cfb(ctx, walk.dst.virt.addr, walk.src.virt.addr, + walk.iv, enc_bytes, CRYPTO_DIR_ENCRYPT, 0); + nbytes &= AES_BLOCK_SIZE - 1; + err = skcipher_walk_done(&walk, nbytes); + } + + /* to handle remaining bytes < AES_BLOCK_SIZE */ + if (walk.nbytes) { + ifx_deu_aes_cfb(ctx, walk.dst.virt.addr, walk.src.virt.addr, + walk.iv, walk.nbytes, CRYPTO_DIR_ENCRYPT, 0); + err = skcipher_walk_done(&walk, 0); + } + + return err; +} + +/*! \fn int cfb_aes_decrypt(struct skcipher_req *req) + * \ingroup IFX_AES_FUNCTIONS + * \brief CFB AES decrypt using linux crypto skcipher + * \param req skcipher request + * \return err +*/ +int cfb_aes_decrypt(struct skcipher_request *req) +{ + struct aes_ctx *ctx = crypto_tfm_ctx(req->base.tfm); + struct skcipher_walk walk; + int err; + unsigned int dec_bytes, nbytes; + + err = skcipher_walk_virt(&walk, req, false); + + while ((nbytes = dec_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) { + dec_bytes -= (nbytes % AES_BLOCK_SIZE); + ifx_deu_aes_cfb(ctx, walk.dst.virt.addr, walk.src.virt.addr, + walk.iv, dec_bytes, CRYPTO_DIR_DECRYPT, 0); + nbytes &= AES_BLOCK_SIZE - 1; + err = skcipher_walk_done(&walk, nbytes); + } + + /* to handle remaining bytes < AES_BLOCK_SIZE */ + if (walk.nbytes) { + ifx_deu_aes_cfb(ctx, walk.dst.virt.addr, walk.src.virt.addr, + walk.iv, walk.nbytes, CRYPTO_DIR_DECRYPT, 0); + err = skcipher_walk_done(&walk, 0); + } + + return err; +} + +/* + * \brief AES function mappings +*/ +struct skcipher_alg ifxdeu_cfb_aes_alg = { + .base.cra_name = "cfb(aes)", + .base.cra_driver_name = "ifxdeu-cfb(aes)", + .base.cra_priority = 400, + .base.cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY, + .base.cra_blocksize = 1, + .base.cra_ctxsize = sizeof(struct aes_ctx), + .base.cra_module = THIS_MODULE, + .base.cra_list = LIST_HEAD_INIT(ifxdeu_cfb_aes_alg.base.cra_list), + .min_keysize = AES_MIN_KEY_SIZE, + .max_keysize = AES_MAX_KEY_SIZE, + .ivsize = AES_BLOCK_SIZE, + .chunksize = AES_BLOCK_SIZE, + .walksize = AES_BLOCK_SIZE, + .setkey = aes_set_key_skcipher, + .encrypt = cfb_aes_encrypt, + .decrypt = cfb_aes_decrypt, +}; + +/*! \fn int ctr_basic_aes_encrypt(struct skcipher_req *req) + * \ingroup IFX_AES_FUNCTIONS + * \brief Counter mode AES encrypt using linux crypto skcipher + * \param req skcipher request + * \return err +*/ +int ctr_basic_aes_encrypt(struct skcipher_request *req) +{ + struct aes_ctx *ctx = crypto_tfm_ctx(req->base.tfm); + struct skcipher_walk walk; + int err; + unsigned int enc_bytes, nbytes; + + err = skcipher_walk_virt(&walk, req, false); + + while ((nbytes = enc_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) { + enc_bytes -= (nbytes % AES_BLOCK_SIZE); + ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr, + walk.iv, enc_bytes, CRYPTO_DIR_ENCRYPT, 0); + nbytes &= AES_BLOCK_SIZE - 1; + err = skcipher_walk_done(&walk, nbytes); + } + + /* to handle remaining bytes < AES_BLOCK_SIZE */ + if (walk.nbytes) { + ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr, + walk.iv, walk.nbytes, CRYPTO_DIR_ENCRYPT, 0); + err = skcipher_walk_done(&walk, 0); + } + + return err; +} + +/*! \fn int ctr_basic_aes_encrypt(struct skcipher_req *req) + * \ingroup IFX_AES_FUNCTIONS + * \brief Counter mode AES decrypt using linux crypto skcipher + * \param req skcipher request + * \return err +*/ +int ctr_basic_aes_decrypt(struct skcipher_request *req) +{ + struct aes_ctx *ctx = crypto_tfm_ctx(req->base.tfm); + struct skcipher_walk walk; + int err; + unsigned int dec_bytes, nbytes; + + err = skcipher_walk_virt(&walk, req, false); + + while ((nbytes = dec_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) { + dec_bytes -= (nbytes % AES_BLOCK_SIZE); + ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr, + walk.iv, dec_bytes, CRYPTO_DIR_DECRYPT, 0); + nbytes &= AES_BLOCK_SIZE - 1; + err = skcipher_walk_done(&walk, nbytes); + } + + /* to handle remaining bytes < AES_BLOCK_SIZE */ + if (walk.nbytes) { + ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr, + walk.iv, walk.nbytes, CRYPTO_DIR_DECRYPT, 0); + err = skcipher_walk_done(&walk, 0); + } + + return err; +} + +/* + * \brief AES function mappings +*/ +struct skcipher_alg ifxdeu_ctr_basic_aes_alg = { + .base.cra_name = "ctr(aes)", + .base.cra_driver_name = "ifxdeu-ctr(aes)", + .base.cra_priority = 400, + .base.cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY, + .base.cra_blocksize = 1, + .base.cra_ctxsize = sizeof(struct aes_ctx), + .base.cra_module = THIS_MODULE, + .base.cra_list = LIST_HEAD_INIT(ifxdeu_ctr_basic_aes_alg.base.cra_list), + .min_keysize = AES_MIN_KEY_SIZE, + .max_keysize = AES_MAX_KEY_SIZE, + .ivsize = AES_BLOCK_SIZE, + .walksize = AES_BLOCK_SIZE, + .setkey = aes_set_key_skcipher, + .encrypt = ctr_basic_aes_encrypt, + .decrypt = ctr_basic_aes_decrypt, +}; + +/*! \fn int ctr_rfc3686_aes_encrypt(struct skcipher_req *req) + * \ingroup IFX_AES_FUNCTIONS + * \brief Counter mode AES (rfc3686) encrypt using linux crypto skcipher + * \param req skcipher request + * \return err +*/ +int ctr_rfc3686_aes_encrypt(struct skcipher_request *req) +{ + struct aes_ctx *ctx = crypto_tfm_ctx(req->base.tfm); + struct skcipher_walk walk; + unsigned int nbytes, enc_bytes; + int err; u8 rfc3686_iv[16]; - blkcipher_walk_init(&walk, dst, src, nbytes); - err = blkcipher_walk_virt(desc, &walk); + err = skcipher_walk_virt(&walk, req, false); + nbytes = walk.nbytes; /* set up counter block */ memcpy(rfc3686_iv, ctx->nonce, CTR_RFC3686_NONCE_SIZE); @@ -831,86 +1240,677 @@ int ctr_rfc3686_aes_decrypt(struct blkcipher_desc *desc, *(__be32 *)(rfc3686_iv + CTR_RFC3686_NONCE_SIZE + CTR_RFC3686_IV_SIZE) = cpu_to_be32(1); - /* scatterlist source is the same size as request size, just process once */ - if (nbytes == walk.nbytes) { - ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr, - rfc3686_iv, nbytes, CRYPTO_DIR_ENCRYPT, 0); - nbytes -= walk.nbytes; - err = blkcipher_walk_done(desc, &walk, nbytes); - return err; - } - - while ((nbytes = walk.nbytes) % (walk.nbytes >= AES_BLOCK_SIZE)) { - ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr, - rfc3686_iv, nbytes, CRYPTO_DIR_DECRYPT, 0); - - nbytes -= walk.nbytes; - bsize -= walk.nbytes; - err = blkcipher_walk_done(desc, &walk, nbytes); + while ((nbytes = enc_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) { + enc_bytes -= (nbytes % AES_BLOCK_SIZE); + ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr, + rfc3686_iv, enc_bytes, CRYPTO_DIR_ENCRYPT, 0); + nbytes &= AES_BLOCK_SIZE - 1; + err = skcipher_walk_done(&walk, nbytes); } /* to handle remaining bytes < AES_BLOCK_SIZE */ if (walk.nbytes) { ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr, rfc3686_iv, walk.nbytes, CRYPTO_DIR_ENCRYPT, 0); - err = blkcipher_walk_done(desc, &walk, 0); + err = skcipher_walk_done(&walk, 0); } return err; } -/* +/*! \fn int ctr_rfc3686_aes_decrypt(struct skcipher_req *req) + * \ingroup IFX_AES_FUNCTIONS + * \brief Counter mode AES (rfc3686) decrypt using linux crypto skcipher + * \param req skcipher request + * \return err +*/ +int ctr_rfc3686_aes_decrypt(struct skcipher_request *req) +{ + struct aes_ctx *ctx = crypto_tfm_ctx(req->base.tfm); + struct skcipher_walk walk; + unsigned int nbytes, dec_bytes; + int err; + u8 rfc3686_iv[16]; + + err = skcipher_walk_virt(&walk, req, false); + nbytes = walk.nbytes; + + /* set up counter block */ + memcpy(rfc3686_iv, ctx->nonce, CTR_RFC3686_NONCE_SIZE); + memcpy(rfc3686_iv + CTR_RFC3686_NONCE_SIZE, walk.iv, CTR_RFC3686_IV_SIZE); + + /* initialize counter portion of counter block */ + *(__be32 *)(rfc3686_iv + CTR_RFC3686_NONCE_SIZE + CTR_RFC3686_IV_SIZE) = + cpu_to_be32(1); + + while ((nbytes = dec_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) { + dec_bytes -= (nbytes % AES_BLOCK_SIZE); + ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr, + rfc3686_iv, dec_bytes, CRYPTO_DIR_DECRYPT, 0); + nbytes &= AES_BLOCK_SIZE - 1; + err = skcipher_walk_done(&walk, nbytes); + } + + /* to handle remaining bytes < AES_BLOCK_SIZE */ + if (walk.nbytes) { + ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr, + rfc3686_iv, walk.nbytes, CRYPTO_DIR_DECRYPT, 0); + err = skcipher_walk_done(&walk, 0); + } + + return err; +} + +/* * \brief AES function mappings */ -struct crypto_alg ifxdeu_ctr_rfc3686_aes_alg = { - .cra_name = "rfc3686(ctr(aes))", - .cra_driver_name = "ifxdeu-ctr-rfc3686(aes)", - .cra_priority = 400, - .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, - .cra_blocksize = AES_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct aes_ctx), - .cra_type = &crypto_blkcipher_type, - .cra_module = THIS_MODULE, - .cra_list = LIST_HEAD_INIT(ifxdeu_ctr_rfc3686_aes_alg.cra_list), - .cra_u = { - .blkcipher = { - .min_keysize = AES_MIN_KEY_SIZE, - .max_keysize = CTR_RFC3686_MAX_KEY_SIZE, - .ivsize = CTR_RFC3686_IV_SIZE, - .setkey = ctr_rfc3686_aes_set_key, - .encrypt = ctr_rfc3686_aes_encrypt, - .decrypt = ctr_rfc3686_aes_decrypt, - } - } +struct skcipher_alg ifxdeu_ctr_rfc3686_aes_alg = { + .base.cra_name = "rfc3686(ctr(aes))", + .base.cra_driver_name = "ifxdeu-ctr-rfc3686(aes)", + .base.cra_priority = 400, + .base.cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY, + .base.cra_blocksize = 1, + .base.cra_ctxsize = sizeof(struct aes_ctx), + .base.cra_module = THIS_MODULE, + .base.cra_list = LIST_HEAD_INIT(ifxdeu_ctr_rfc3686_aes_alg.base.cra_list), + .min_keysize = CTR_RFC3686_MIN_KEY_SIZE, + .max_keysize = CTR_RFC3686_MAX_KEY_SIZE, + .ivsize = CTR_RFC3686_IV_SIZE, + .walksize = AES_BLOCK_SIZE, + .setkey = ctr_rfc3686_aes_set_key_skcipher, + .encrypt = ctr_rfc3686_aes_encrypt, + .decrypt = ctr_rfc3686_aes_decrypt, }; +static int aes_cbcmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_final); + +/*! \fn static void aes_cbcmac_transform(struct shash_desc *desc, u8 const *in) + * \ingroup IFX_aes_cbcmac_FUNCTIONS + * \brief save input block to context + * \param desc linux crypto shash descriptor + * \param in 16-byte block of input +*/ +static void aes_cbcmac_transform(struct shash_desc *desc, u8 const *in) +{ + struct aes_ctx *mctx = crypto_shash_ctx(desc->tfm); + + if ( ((mctx->dbn)+1) > AES_CBCMAC_DBN_TEMP_SIZE ) + { + //printk("aes_cbcmac_DBN_TEMP_SIZE exceeded\n"); + aes_cbcmac_final_impl(desc, (u8 *)mctx->hash, false); + } + + memcpy(&mctx->temp[mctx->dbn], in, 16); //dbn workaround + mctx->dbn += 1; +} + +/*! \fn int aes_cbcmac_setkey(struct crypto_shash *tfm, const u8 *key, unsigned int keylen) + * \ingroup IFX_aes_cbcmac_FUNCTIONS + * \brief sets cbcmac aes key + * \param tfm linux crypto shash transform + * \param key input key + * \param keylen key +*/ +static int aes_cbcmac_setkey(struct crypto_shash *tfm, const u8 *key, unsigned int keylen) +{ + return aes_set_key(crypto_shash_tfm(tfm), key, keylen); + + return 0; +} + +/*! \fn void aes_cbcmac_init(struct shash_desc *desc) + * \ingroup IFX_aes_cbcmac_FUNCTIONS + * \brief initialize md5 hmac context + * \param desc linux crypto shash descriptor +*/ +static int aes_cbcmac_init(struct shash_desc *desc) +{ + + struct aes_ctx *mctx = crypto_shash_ctx(desc->tfm); + + mctx->dbn = 0; //dbn workaround + mctx->started = 0; + mctx->byte_count = 0; + memset(mctx->hash, 0, AES_BLOCK_SIZE); + + return 0; +} + +/*! \fn void aes_cbcmac_update(struct shash_desc *desc, const u8 *data, unsigned int len) + * \ingroup IFX_aes_cbcmac_FUNCTIONS + * \brief on-the-fly cbcmac aes computation + * \param desc linux crypto shash descriptor + * \param data input data + * \param len size of input data +*/ +static int aes_cbcmac_update(struct shash_desc *desc, const u8 *data, unsigned int len) +{ + struct aes_ctx *mctx = crypto_shash_ctx(desc->tfm); + const u32 avail = sizeof(mctx->block) - (mctx->byte_count & 0x0f); + + mctx->byte_count += len; + + if (avail > len) { + memcpy((char *)mctx->block + (sizeof(mctx->block) - avail), + data, len); + return 0; + } + + memcpy((char *)mctx->block + (sizeof(mctx->block) - avail), + data, avail); + + aes_cbcmac_transform(desc, mctx->block); + data += avail; + len -= avail; + + while (len >= sizeof(mctx->block)) { + memcpy(mctx->block, data, sizeof(mctx->block)); + aes_cbcmac_transform(desc, mctx->block); + data += sizeof(mctx->block); + len -= sizeof(mctx->block); + } + + memcpy(mctx->block, data, len); + return 0; +} + +/*! \fn static int aes_cbcmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_final) + * \ingroup IFX_aes_cbcmac_FUNCTIONS + * \brief compute final or intermediate md5 hmac value + * \param desc linux crypto shash descriptor + * \param out final cbcmac aes output value + * \param in finalize or intermediate processing +*/ +static int aes_cbcmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_final) +{ + struct aes_ctx *mctx = crypto_shash_ctx(desc->tfm); + const unsigned int offset = mctx->byte_count & 0x0f; + char *p = (char *)mctx->block + offset; + volatile struct aes_t *aes = (volatile struct aes_t *) AES_START; + unsigned long flag; + int i = 0; + int dbn; + u32 *in = mctx->temp[0]; + + CRTCL_SECT_START; + + aes_set_key_hw (mctx); + + aes->controlr.E_D = !CRYPTO_DIR_ENCRYPT; //encryption + aes->controlr.O = 1; //0 ECB 1 CBC 2 OFB 3 CFB 4 CTR + + //aes->controlr.F = 128; //default; only for CFB and OFB modes; change only for customer-specific apps + + //printk("\ndbn = %d\n", mctx->dbn); + + if (mctx->started) { + aes->IV3R = DEU_ENDIAN_SWAP(*(u32 *) mctx->hash); + aes->IV2R = DEU_ENDIAN_SWAP(*((u32 *) mctx->hash + 1)); + aes->IV1R = DEU_ENDIAN_SWAP(*((u32 *) mctx->hash + 2)); + aes->IV0R = DEU_ENDIAN_SWAP(*((u32 *) mctx->hash + 3)); + } else { + mctx->started = 1; + aes->IV3R = 0; + aes->IV2R = 0; + aes->IV1R = 0; + aes->IV0R = 0; + } + + i = 0; + for (dbn = 0; dbn < mctx->dbn; dbn++) + { + aes->ID3R = INPUT_ENDIAN_SWAP(*((u32 *) in + (i * 4) + 0)); + aes->ID2R = INPUT_ENDIAN_SWAP(*((u32 *) in + (i * 4) + 1)); + aes->ID1R = INPUT_ENDIAN_SWAP(*((u32 *) in + (i * 4) + 2)); + aes->ID0R = INPUT_ENDIAN_SWAP(*((u32 *) in + (i * 4) + 3)); /* start crypto */ + + while (aes->controlr.BUS) { + // this will not take long + } + + in += 4; + } + + *((u32 *) mctx->hash) = DEU_ENDIAN_SWAP(aes->IV3R); + *((u32 *) mctx->hash + 1) = DEU_ENDIAN_SWAP(aes->IV2R); + *((u32 *) mctx->hash + 2) = DEU_ENDIAN_SWAP(aes->IV1R); + *((u32 *) mctx->hash + 3) = DEU_ENDIAN_SWAP(aes->IV0R); + + if (hash_final && offset) { + aes->controlr.O = 0; //0 ECB 1 CBC 2 OFB 3 CFB 4 CTR + crypto_xor(mctx->block, mctx->hash, offset); + + memcpy(p, mctx->hash + offset, (AES_BLOCK_SIZE - offset)); + + aes->ID3R = INPUT_ENDIAN_SWAP(*((u32 *) mctx->block + 0)); + aes->ID2R = INPUT_ENDIAN_SWAP(*((u32 *) mctx->block + 1)); + aes->ID1R = INPUT_ENDIAN_SWAP(*((u32 *) mctx->block + 2)); + aes->ID0R = INPUT_ENDIAN_SWAP(*((u32 *) mctx->block + 3)); /* start crypto */ + + while (aes->controlr.BUS) { + // this will not take long + } + + *((u32 *) mctx->hash) = DEU_ENDIAN_SWAP(aes->OD3R); + *((u32 *) mctx->hash + 1) = DEU_ENDIAN_SWAP(aes->OD2R); + *((u32 *) mctx->hash + 2) = DEU_ENDIAN_SWAP(aes->OD1R); + *((u32 *) mctx->hash + 3) = DEU_ENDIAN_SWAP(aes->OD0R); + } + + CRTCL_SECT_END; + + if (hash_final) { + memcpy(out, mctx->hash, AES_BLOCK_SIZE); + /* reset the context after we finish with the hash */ + aes_cbcmac_init(desc); + } else { + mctx->dbn = 0; + } + return 0; +} + +/*! \fn static int aes_cbcmac_final(struct crypto_tfm *tfm, u8 *out) + * \ingroup IFX_aes_cbcmac_FUNCTIONS + * \brief call aes_cbcmac_final_impl with hash_final true + * \param tfm linux crypto algo transform + * \param out final md5 hmac output value +*/ +static int aes_cbcmac_final(struct shash_desc *desc, u8 *out) +{ + return aes_cbcmac_final_impl(desc, out, true); +} + +/*! \fn void aes_cbcmac_init_tfm(struct crypto_tfm *tfm) + * \ingroup IFX_aes_cbcmac_FUNCTIONS + * \brief initialize pointers in aes_ctx + * \param tfm linux crypto shash transform +*/ +static int aes_cbcmac_init_tfm(struct crypto_tfm *tfm) +{ + struct aes_ctx *mctx = crypto_tfm_ctx(tfm); + mctx->temp = kzalloc(AES_BLOCK_SIZE * AES_CBCMAC_DBN_TEMP_SIZE, GFP_KERNEL); + if (IS_ERR(mctx->temp)) return PTR_ERR(mctx->temp); + + return 0; +} + +/*! \fn void aes_cbcmac_exit_tfm(struct crypto_tfm *tfm) + * \ingroup IFX_aes_cbcmac_FUNCTIONS + * \brief free pointers in aes_ctx + * \param tfm linux crypto shash transform +*/ +static void aes_cbcmac_exit_tfm(struct crypto_tfm *tfm) +{ + struct aes_ctx *mctx = crypto_tfm_ctx(tfm); + kfree(mctx->temp); +} + +/* + * \brief aes_cbcmac function mappings +*/ +static struct shash_alg ifxdeu_cbcmac_aes_alg = { + .digestsize = AES_BLOCK_SIZE, + .init = aes_cbcmac_init, + .update = aes_cbcmac_update, + .final = aes_cbcmac_final, + .setkey = aes_cbcmac_setkey, + .descsize = sizeof(struct aes_ctx), + .base = { + .cra_name = "cbcmac(aes)", + .cra_driver_name= "ifxdeu-cbcmac(aes)", + .cra_priority = 400, + .cra_ctxsize = sizeof(struct aes_ctx), + .cra_flags = CRYPTO_ALG_TYPE_HASH | CRYPTO_ALG_KERN_DRIVER_ONLY, + .cra_blocksize = 1, + .cra_module = THIS_MODULE, + .cra_init = aes_cbcmac_init_tfm, + .cra_exit = aes_cbcmac_exit_tfm, + } +}; + +/*! \fn int aes_set_key_aead (struct crypto_aead *aead, const uint8_t *in_key, unsigned int key_len) + * \ingroup IFX_AES_FUNCTIONS + * \brief sets the AES keys for aead gcm + * \param aead linux crypto aead + * \param in_key input key + * \param key_len key lengths of 16, 24 and 32 bytes supported + * \return -EINVAL - bad key length, 0 - SUCCESS +*/ +int aes_set_key_aead (struct crypto_aead *aead, const u8 *in_key, unsigned int key_len) +{ + struct aes_ctx *ctx = crypto_aead_ctx(aead); + int err; + + err = aes_set_key(&aead->base, in_key, key_len); + if (err) return err; + + memset(ctx->block, 0, sizeof(ctx->block)); + memset(ctx->lastbuffer, 0, AES_BLOCK_SIZE); + ifx_deu_aes_ctr(ctx, ctx->block, ctx->block, + ctx->lastbuffer, AES_BLOCK_SIZE, CRYPTO_DIR_ENCRYPT, 0); + if (ctx->gf128) gf128mul_free_4k(ctx->gf128); + ctx->gf128 = gf128mul_init_4k_lle((be128 *)ctx->block); + + return err; +} + +/*! \fn int gcm_aes_setauthsize (struct crypto_aead *aead, unsigned int authsize) + * \ingroup IFX_AES_FUNCTIONS + * \brief sets the AES keys for aead gcm + * \param aead linux crypto aead + * \param in_key input authsize + * \return -EINVAL - bad authsize length, 0 - SUCCESS +*/ +int gcm_aes_setauthsize (struct crypto_aead *aead, unsigned int authsize) +{ + return crypto_gcm_check_authsize(authsize); +} + +/*! \fn int gcm_aes_encrypt(struct aead_request *req) + * \ingroup IFX_AES_FUNCTIONS + * \brief GCM AES encrypt using linux crypto aead + * \param req aead request + * \return err +*/ +int gcm_aes_encrypt(struct aead_request *req) +{ + struct aes_ctx *ctx = crypto_tfm_ctx(req->base.tfm); + struct skcipher_walk walk; + struct skcipher_request request; + int err; + unsigned int enc_bytes, nbytes; + be128 lengths; + u8 iv[AES_BLOCK_SIZE]; + + lengths.a = cpu_to_be64(req->assoclen * 8); + lengths.b = cpu_to_be64(req->cryptlen * 8); + + memset(ctx->hash, 0, sizeof(ctx->hash)); + memset(ctx->block, 0, sizeof(ctx->block)); + memcpy(iv, req->iv, GCM_AES_IV_SIZE); + *(__be32 *)((void *)iv + GCM_AES_IV_SIZE) = cpu_to_be32(1); + ifx_deu_aes_ctr(ctx, ctx->block, ctx->block, + iv, 16, CRYPTO_DIR_ENCRYPT, 0); + + request.cryptlen = req->cryptlen + req->assoclen; + request.src = req->src; + request.dst = req->dst; + request.base = req->base; + + crypto_skcipher_alg(crypto_skcipher_reqtfm(&request))->walksize = AES_BLOCK_SIZE; + + if (req->assoclen && (req->assoclen < AES_BLOCK_SIZE)) + crypto_skcipher_alg(crypto_skcipher_reqtfm(&request))->walksize = req->assoclen; + + err = skcipher_walk_virt(&walk, &request, false); + + //process assoc data if available + if (req->assoclen > 0) { + unsigned int assoc_remain, ghashlen; + + assoc_remain = req->assoclen; + ghashlen = min(req->assoclen, walk.nbytes); + while ((nbytes = enc_bytes = ghashlen) && (ghashlen >= AES_BLOCK_SIZE)) { + u8 *temp; + if (nbytes > req->assoclen) nbytes = enc_bytes = req->assoclen; + enc_bytes -= (nbytes % AES_BLOCK_SIZE); + memcpy(walk.dst.virt.addr, walk.src.virt.addr, enc_bytes); + assoc_remain -= enc_bytes; + temp = walk.dst.virt.addr; + while (enc_bytes > 0) { + u128_xor((u128 *)ctx->hash, (u128 *)ctx->hash, (u128 *)temp); + gf128mul_4k_lle((be128 *)ctx->hash, ctx->gf128); + enc_bytes -= AES_BLOCK_SIZE; + temp += 16; + } + if (assoc_remain < AES_BLOCK_SIZE) walk.stride = assoc_remain; + if (assoc_remain == 0) walk.stride = AES_BLOCK_SIZE; + enc_bytes = nbytes - (nbytes % AES_BLOCK_SIZE); + err = skcipher_walk_done(&walk, (walk.nbytes - enc_bytes)); + ghashlen = min(assoc_remain, walk.nbytes); + } + + if ((enc_bytes = ghashlen)) { + memcpy(ctx->lastbuffer, walk.src.virt.addr, enc_bytes); + memset(ctx->lastbuffer + enc_bytes, 0, (AES_BLOCK_SIZE - enc_bytes)); + memcpy(walk.dst.virt.addr, walk.src.virt.addr, ghashlen); + u128_xor((u128 *)ctx->hash, (u128 *)ctx->hash, (u128 *)ctx->lastbuffer); + gf128mul_4k_lle((be128 *)ctx->hash, ctx->gf128); + walk.stride = AES_BLOCK_SIZE; + err = skcipher_walk_done(&walk, (walk.nbytes - ghashlen)); + } + } + + //crypt and hash + while ((nbytes = enc_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) { + u8 *temp; + enc_bytes -= (nbytes % AES_BLOCK_SIZE); + ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr, + iv, enc_bytes, CRYPTO_DIR_ENCRYPT, 0); + nbytes &= AES_BLOCK_SIZE - 1; + temp = walk.dst.virt.addr; + while (enc_bytes) { + u128_xor((u128 *)ctx->hash, (u128 *)ctx->hash, (u128 *)temp); + gf128mul_4k_lle((be128 *)ctx->hash, ctx->gf128); + enc_bytes -= AES_BLOCK_SIZE; + temp += 16; + } + err = skcipher_walk_done(&walk, nbytes); + } + + /* crypt and hash remaining bytes < AES_BLOCK_SIZE */ + if ((enc_bytes = walk.nbytes)) { + ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr, + iv, walk.nbytes, CRYPTO_DIR_ENCRYPT, 0); + memcpy(ctx->lastbuffer, walk.dst.virt.addr, enc_bytes); + memset(ctx->lastbuffer + enc_bytes, 0, (AES_BLOCK_SIZE - enc_bytes)); + u128_xor((u128 *)ctx->hash, (u128 *)ctx->hash, (u128 *)ctx->lastbuffer); + gf128mul_4k_lle((be128 *)ctx->hash, ctx->gf128); + err = skcipher_walk_done(&walk, 0); + } + + //finalize and copy hash + u128_xor((u128 *)ctx->hash, (u128 *)ctx->hash, (u128 *)&lengths); + gf128mul_4k_lle((be128 *)ctx->hash, ctx->gf128); + u128_xor((u128 *)ctx->hash, (u128 *)ctx->hash, (u128 *)ctx->block); + scatterwalk_map_and_copy(ctx->hash, req->dst, req->cryptlen + req->assoclen, crypto_aead_authsize(crypto_aead_reqtfm(req)), 1); + + aead_request_complete(req, 0); + + return err; +} + +/*! \fn int gcm_aes_decrypt(struct aead_request *req) + * \ingroup IFX_AES_FUNCTIONS + * \brief GCM AES decrypt using linux crypto aead + * \param req aead request + * \return err +*/ +int gcm_aes_decrypt(struct aead_request *req) +{ + struct aes_ctx *ctx = crypto_tfm_ctx(req->base.tfm); + struct skcipher_walk walk; + struct skcipher_request request; + int err; + unsigned int dec_bytes, nbytes, authsize; + be128 lengths; + u8 iv[AES_BLOCK_SIZE]; + + authsize = crypto_aead_authsize(crypto_aead_reqtfm(req)); + + lengths.a = cpu_to_be64(req->assoclen * 8); + lengths.b = cpu_to_be64((req->cryptlen - authsize) * 8); + + memset(ctx->hash, 0, sizeof(ctx->hash)); + memset(ctx->block, 0, sizeof(ctx->block)); + memcpy(iv, req->iv, GCM_AES_IV_SIZE); + *(__be32 *)((void *)iv + GCM_AES_IV_SIZE) = cpu_to_be32(1); + ifx_deu_aes_ctr(ctx, ctx->block, ctx->block, + iv, 16, CRYPTO_DIR_ENCRYPT, 0); + + request.cryptlen = req->cryptlen + req->assoclen - authsize; + request.src = req->src; + request.dst = req->dst; + request.base = req->base; + crypto_skcipher_alg(crypto_skcipher_reqtfm(&request))->walksize = AES_BLOCK_SIZE; + + if (req->assoclen && (req->assoclen < AES_BLOCK_SIZE)) + crypto_skcipher_alg(crypto_skcipher_reqtfm(&request))->walksize = req->assoclen; + + err = skcipher_walk_virt(&walk, &request, false); + + //process assoc data if available + if (req->assoclen > 0) { + unsigned int assoc_remain, ghashlen; + + assoc_remain = req->assoclen; + ghashlen = min(req->assoclen, walk.nbytes); + while ((nbytes = dec_bytes = ghashlen) && (ghashlen >= AES_BLOCK_SIZE)) { + u8 *temp; + if (nbytes > req->assoclen) nbytes = dec_bytes = req->assoclen; + dec_bytes -= (nbytes % AES_BLOCK_SIZE); + memcpy(walk.dst.virt.addr, walk.src.virt.addr, dec_bytes); + assoc_remain -= dec_bytes; + temp = walk.dst.virt.addr; + while (dec_bytes > 0) { + u128_xor((u128 *)ctx->hash, (u128 *)ctx->hash, (u128 *)temp); + gf128mul_4k_lle((be128 *)ctx->hash, ctx->gf128); + dec_bytes -= AES_BLOCK_SIZE; + temp += 16; + } + if (assoc_remain < AES_BLOCK_SIZE) walk.stride = assoc_remain; + if (assoc_remain == 0) walk.stride = AES_BLOCK_SIZE; + dec_bytes = nbytes - (nbytes % AES_BLOCK_SIZE); + err = skcipher_walk_done(&walk, (walk.nbytes - dec_bytes)); + ghashlen = min(assoc_remain, walk.nbytes); + } + + if ((dec_bytes = ghashlen)) { + memcpy(ctx->lastbuffer, walk.src.virt.addr, dec_bytes); + memset(ctx->lastbuffer + dec_bytes, 0, (AES_BLOCK_SIZE - dec_bytes)); + memcpy(walk.dst.virt.addr, walk.src.virt.addr, ghashlen); + u128_xor((u128 *)ctx->hash, (u128 *)ctx->hash, (u128 *)ctx->lastbuffer); + gf128mul_4k_lle((be128 *)ctx->hash, ctx->gf128); + walk.stride = AES_BLOCK_SIZE; + err = skcipher_walk_done(&walk, (walk.nbytes - ghashlen)); + } + } + + //crypt and hash + while ((nbytes = dec_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) { + u8 *temp; + dec_bytes -= (nbytes % AES_BLOCK_SIZE); + temp = walk.src.virt.addr; + while (dec_bytes) { + u128_xor((u128 *)ctx->hash, (u128 *)ctx->hash, (u128 *)temp); + gf128mul_4k_lle((be128 *)ctx->hash, ctx->gf128); + dec_bytes -= AES_BLOCK_SIZE; + temp += 16; + } + dec_bytes = nbytes - (nbytes % AES_BLOCK_SIZE); + ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr, + iv, dec_bytes, CRYPTO_DIR_DECRYPT, 0); + nbytes &= AES_BLOCK_SIZE - 1; + err = skcipher_walk_done(&walk, nbytes); + } + + /* crypt and hash remaining bytes < AES_BLOCK_SIZE */ + if ((dec_bytes = walk.nbytes)) { + memcpy(ctx->lastbuffer, walk.src.virt.addr, dec_bytes); + memset(ctx->lastbuffer + dec_bytes, 0, (AES_BLOCK_SIZE - dec_bytes)); + u128_xor((u128 *)ctx->hash, (u128 *)ctx->hash, (u128 *)ctx->lastbuffer); + gf128mul_4k_lle((be128 *)ctx->hash, ctx->gf128); + ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr, + iv, walk.nbytes, CRYPTO_DIR_DECRYPT, 0); + err = skcipher_walk_done(&walk, 0); + } + + //finalize and copy hash + u128_xor((u128 *)ctx->hash, (u128 *)ctx->hash, (u128 *)&lengths); + gf128mul_4k_lle((be128 *)ctx->hash, ctx->gf128); + u128_xor((u128 *)ctx->hash, (u128 *)ctx->hash, (u128 *)ctx->block); + + scatterwalk_map_and_copy(ctx->lastbuffer, req->src, req->cryptlen + req->assoclen - authsize, authsize, 0); + err = crypto_memneq(ctx->lastbuffer, ctx->hash, authsize) ? -EBADMSG : 0; + + aead_request_complete(req, 0); + + return err; +} + +/*! \fn void aes_gcm_exit_tfm(struct crypto_tfm *tfm) + * \ingroup IFX_aes_cbcmac_FUNCTIONS + * \brief free pointers in aes_ctx + * \param tfm linux crypto shash transform +*/ +static void aes_gcm_exit_tfm(struct crypto_tfm *tfm) +{ + struct aes_ctx *ctx = crypto_tfm_ctx(tfm); + if (ctx->gf128) gf128mul_free_4k(ctx->gf128); +} + +/* + * \brief AES function mappings +*/ +struct aead_alg ifxdeu_gcm_aes_alg = { + .base.cra_name = "gcm(aes)", + .base.cra_driver_name = "ifxdeu-gcm(aes)", + .base.cra_priority = 400, + .base.cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY, + .base.cra_blocksize = 1, + .base.cra_ctxsize = sizeof(struct aes_ctx), + .base.cra_module = THIS_MODULE, + .base.cra_list = LIST_HEAD_INIT(ifxdeu_gcm_aes_alg.base.cra_list), + .base.cra_exit = aes_gcm_exit_tfm, + .ivsize = GCM_AES_IV_SIZE, + .maxauthsize = AES_BLOCK_SIZE, + .chunksize = AES_BLOCK_SIZE, + .setkey = aes_set_key_aead, + .encrypt = gcm_aes_encrypt, + .decrypt = gcm_aes_decrypt, + .setauthsize = gcm_aes_setauthsize, +}; /*! \fn int ifxdeu_init_aes (void) * \ingroup IFX_AES_FUNCTIONS - * \brief function to initialize AES driver - * \return ret -*/ + * \brief function to initialize AES driver + * \return ret +*/ int ifxdeu_init_aes (void) { int ret = -ENOSYS; + aes_chip_init(); if ((ret = crypto_register_alg(&ifxdeu_aes_alg))) goto aes_err; - if ((ret = crypto_register_alg(&ifxdeu_ecb_aes_alg))) + if ((ret = crypto_register_skcipher(&ifxdeu_ecb_aes_alg))) goto ecb_aes_err; - if ((ret = crypto_register_alg(&ifxdeu_cbc_aes_alg))) + if ((ret = crypto_register_skcipher(&ifxdeu_cbc_aes_alg))) goto cbc_aes_err; - if ((ret = crypto_register_alg(&ifxdeu_ctr_basic_aes_alg))) + if ((ret = crypto_register_skcipher(&ifxdeu_xts_aes_alg))) + goto xts_aes_err; + + if ((ret = crypto_register_skcipher(&ifxdeu_ofb_aes_alg))) + goto ofb_aes_err; + + if ((ret = crypto_register_skcipher(&ifxdeu_cfb_aes_alg))) + goto cfb_aes_err; + + if ((ret = crypto_register_skcipher(&ifxdeu_ctr_basic_aes_alg))) goto ctr_basic_aes_err; - if ((ret = crypto_register_alg(&ifxdeu_ctr_rfc3686_aes_alg))) + if ((ret = crypto_register_skcipher(&ifxdeu_ctr_rfc3686_aes_alg))) goto ctr_rfc3686_aes_err; - aes_chip_init (); + if ((ret = crypto_register_shash(&ifxdeu_cbcmac_aes_alg))) + goto cbcmac_aes_err; + + if ((ret = crypto_register_aead(&ifxdeu_gcm_aes_alg))) + goto gcm_aes_err; CRTCL_SECT_INIT; @@ -918,20 +1918,40 @@ int ifxdeu_init_aes (void) printk (KERN_NOTICE "IFX DEU AES initialized%s%s.\n", disable_multiblock ? "" : " (multiblock)", disable_deudma ? "" : " (DMA)"); return ret; +gcm_aes_err: + crypto_unregister_aead(&ifxdeu_gcm_aes_alg); + printk (KERN_ERR "IFX gcm_aes initialization failed!\n"); + return ret; +cbcmac_aes_err: + crypto_unregister_shash(&ifxdeu_cbcmac_aes_alg); + printk (KERN_ERR "IFX cbcmac_aes initialization failed!\n"); + return ret; ctr_rfc3686_aes_err: - crypto_unregister_alg(&ifxdeu_ctr_rfc3686_aes_alg); + crypto_unregister_skcipher(&ifxdeu_ctr_rfc3686_aes_alg); printk (KERN_ERR "IFX ctr_rfc3686_aes initialization failed!\n"); return ret; ctr_basic_aes_err: - crypto_unregister_alg(&ifxdeu_ctr_basic_aes_alg); + crypto_unregister_skcipher(&ifxdeu_ctr_basic_aes_alg); printk (KERN_ERR "IFX ctr_basic_aes initialization failed!\n"); return ret; +cfb_aes_err: + crypto_unregister_skcipher(&ifxdeu_cfb_aes_alg); + printk (KERN_ERR "IFX cfb_aes initialization failed!\n"); + return ret; +ofb_aes_err: + crypto_unregister_skcipher(&ifxdeu_ofb_aes_alg); + printk (KERN_ERR "IFX ofb_aes initialization failed!\n"); + return ret; +xts_aes_err: + crypto_unregister_skcipher(&ifxdeu_xts_aes_alg); + printk (KERN_ERR "IFX xts_aes initialization failed!\n"); + return ret; cbc_aes_err: - crypto_unregister_alg(&ifxdeu_cbc_aes_alg); + crypto_unregister_skcipher(&ifxdeu_cbc_aes_alg); printk (KERN_ERR "IFX cbc_aes initialization failed!\n"); return ret; ecb_aes_err: - crypto_unregister_alg(&ifxdeu_ecb_aes_alg); + crypto_unregister_skcipher(&ifxdeu_ecb_aes_alg); printk (KERN_ERR "IFX aes initialization failed!\n"); return ret; aes_err: @@ -942,16 +1962,18 @@ aes_err: /*! \fn void ifxdeu_fini_aes (void) * \ingroup IFX_AES_FUNCTIONS - * \brief unregister aes driver -*/ + * \brief unregister aes driver +*/ void ifxdeu_fini_aes (void) { crypto_unregister_alg (&ifxdeu_aes_alg); - crypto_unregister_alg (&ifxdeu_ecb_aes_alg); - crypto_unregister_alg (&ifxdeu_cbc_aes_alg); - crypto_unregister_alg (&ifxdeu_ctr_basic_aes_alg); - crypto_unregister_alg (&ifxdeu_ctr_rfc3686_aes_alg); - + crypto_unregister_skcipher (&ifxdeu_ecb_aes_alg); + crypto_unregister_skcipher (&ifxdeu_cbc_aes_alg); + crypto_unregister_skcipher (&ifxdeu_xts_aes_alg); + crypto_unregister_skcipher (&ifxdeu_ofb_aes_alg); + crypto_unregister_skcipher (&ifxdeu_cfb_aes_alg); + crypto_unregister_skcipher (&ifxdeu_ctr_basic_aes_alg); + crypto_unregister_skcipher (&ifxdeu_ctr_rfc3686_aes_alg); + crypto_unregister_shash (&ifxdeu_cbcmac_aes_alg); + crypto_unregister_aead (&ifxdeu_gcm_aes_alg); } - - diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_arc4.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_arc4.c index 9faad94016..51f988fe43 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_arc4.c +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_arc4.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -88,7 +89,6 @@ struct arc4_ctx { extern int disable_deudma; extern int disable_multiblock; - /*! \fn static void _deu_arc4 (void *ctx_arg, u8 *out_arg, const u8 *in_arg, u8 *iv_arg, u32 nbytes, int encdec, int mode) \ingroup IFX_ARC4_FUNCTIONS \brief main interface to ARC4 hardware @@ -203,6 +203,19 @@ static int arc4_set_key(struct crypto_tfm *tfm, const u8 *inkey, return 0; } +/*! \fn static int arc4_set_key_skcipher(struct crypto_skcipher *tfm, const u8 *in_key, unsigned int key_len) + \ingroup IFX_ARC4_FUNCTIONS + \brief sets ARC4 key + \param tfm linux crypto skcipher + \param in_key input key + \param key_len key lengths less than or equal to 16 bytes supported +*/ +static int arc4_set_key_skcipher(struct crypto_skcipher *tfm, const u8 *inkey, + unsigned int key_len) +{ + return arc4_set_key(crypto_skcipher_ctx(tfm), inkey, key_len); +} + /*! \fn static void _deu_arc4_ecb(void *ctx, uint8_t *dst, const uint8_t *src, uint8_t *iv, size_t nbytes, int encdec, int inplace) \ingroup IFX_ARC4_FUNCTIONS \brief sets ARC4 hardware to ECB mode @@ -243,7 +256,7 @@ static struct crypto_alg ifxdeu_arc4_alg = { .cra_name = "arc4", .cra_driver_name = "ifxdeu-arc4", .cra_priority = 300, - .cra_flags = CRYPTO_ALG_TYPE_CIPHER, + .cra_flags = CRYPTO_ALG_TYPE_CIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY, .cra_blocksize = ARC4_BLOCK_SIZE, .cra_ctxsize = sizeof(struct arc4_ctx), .cra_module = THIS_MODULE, @@ -259,61 +272,51 @@ static struct crypto_alg ifxdeu_arc4_alg = { } }; -/*! \fn static int ecb_arc4_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) +/*! \fn static int ecb_arc4_encrypt(struct skcipher_request *req) \ingroup IFX_ARC4_FUNCTIONS - \brief ECB ARC4 encrypt using linux crypto blkcipher - \param desc blkcipher descriptor - \param dst output scatterlist - \param src input scatterlist - \param nbytes data size in bytes -*/ -static int ecb_arc4_encrypt(struct blkcipher_desc *desc, - struct scatterlist *dst, struct scatterlist *src, - unsigned int nbytes) + \brief ECB ARC4 encrypt using linux crypto skcipher + \param req skcipher_request +*/ +static int ecb_arc4_encrypt(struct skcipher_request *req) { - struct arc4_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - struct blkcipher_walk walk; + struct arc4_ctx *ctx = crypto_tfm_ctx(req->base.tfm); + struct skcipher_walk walk; + unsigned int nbytes; int err; DPRINTF(1, "\n"); - blkcipher_walk_init(&walk, dst, src, nbytes); - err = blkcipher_walk_virt(desc, &walk); + err = skcipher_walk_virt(&walk, req, false); while ((nbytes = walk.nbytes)) { _deu_arc4_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr, NULL, nbytes, CRYPTO_DIR_ENCRYPT, 0); nbytes &= ARC4_BLOCK_SIZE - 1; - err = blkcipher_walk_done(desc, &walk, nbytes); + err = skcipher_walk_done(&walk, nbytes); } return err; } -/*! \fn static int ecb_arc4_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) +/*! \fn static int ecb_arc4_decrypt(struct skcipher_request *req) \ingroup IFX_ARC4_FUNCTIONS - \brief ECB ARC4 decrypt using linux crypto blkcipher - \param desc blkcipher descriptor - \param dst output scatterlist - \param src input scatterlist - \param nbytes data size in bytes -*/ -static int ecb_arc4_decrypt(struct blkcipher_desc *desc, - struct scatterlist *dst, struct scatterlist *src, - unsigned int nbytes) + \brief ECB ARC4 decrypt using linux crypto skcipher + \param desc skcipher_request +*/ +static int ecb_arc4_decrypt(struct skcipher_request *req) { - struct arc4_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - struct blkcipher_walk walk; + struct arc4_ctx *ctx = crypto_tfm_ctx(req->base.tfm); + struct skcipher_walk walk; + unsigned int nbytes; int err; DPRINTF(1, "\n"); - blkcipher_walk_init(&walk, dst, src, nbytes); - err = blkcipher_walk_virt(desc, &walk); + err = skcipher_walk_virt(&walk, req, false); while ((nbytes = walk.nbytes)) { _deu_arc4_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr, NULL, nbytes, CRYPTO_DIR_DECRYPT, 0); nbytes &= ARC4_BLOCK_SIZE - 1; - err = blkcipher_walk_done(desc, &walk, nbytes); + err = skcipher_walk_done(&walk, nbytes); } return err; @@ -322,25 +325,20 @@ static int ecb_arc4_decrypt(struct blkcipher_desc *desc, /* * \brief ARC4 function mappings */ -static struct crypto_alg ifxdeu_ecb_arc4_alg = { - .cra_name = "ecb(arc4)", - .cra_driver_name = "ifxdeu-ecb(arc4)", - .cra_priority = 400, - .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, - .cra_blocksize = ARC4_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct arc4_ctx), - .cra_type = &crypto_blkcipher_type, - .cra_module = THIS_MODULE, - .cra_list = LIST_HEAD_INIT(ifxdeu_ecb_arc4_alg.cra_list), - .cra_u = { - .blkcipher = { - .min_keysize = ARC4_MIN_KEY_SIZE, - .max_keysize = ARC4_MAX_KEY_SIZE, - .setkey = arc4_set_key, - .encrypt = ecb_arc4_encrypt, - .decrypt = ecb_arc4_decrypt, - } - } +static struct skcipher_alg ifxdeu_ecb_arc4_alg = { + .base.cra_name = "ecb(arc4)", + .base.cra_driver_name = "ifxdeu-ecb(arc4)", + .base.cra_priority = 400, + .base.cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY, + .base.cra_blocksize = ARC4_BLOCK_SIZE, + .base.cra_ctxsize = sizeof(struct arc4_ctx), + .base.cra_module = THIS_MODULE, + .base.cra_list = LIST_HEAD_INIT(ifxdeu_ecb_arc4_alg.base.cra_list), + .min_keysize = ARC4_MIN_KEY_SIZE, + .max_keysize = ARC4_MAX_KEY_SIZE, + .setkey = arc4_set_key_skcipher, + .encrypt = ecb_arc4_encrypt, + .decrypt = ecb_arc4_decrypt, }; /*! \fn int ifxdeu_init_arc4(void) @@ -355,7 +353,7 @@ int ifxdeu_init_arc4(void) if ((ret = crypto_register_alg(&ifxdeu_arc4_alg))) goto arc4_err; - if ((ret = crypto_register_alg(&ifxdeu_ecb_arc4_alg))) + if ((ret = crypto_register_skcipher(&ifxdeu_ecb_arc4_alg))) goto ecb_arc4_err; arc4_chip_init (); @@ -370,7 +368,7 @@ arc4_err: printk(KERN_ERR "IFX arc4 initialization failed!\n"); return ret; ecb_arc4_err: - crypto_unregister_alg(&ifxdeu_ecb_arc4_alg); + crypto_unregister_skcipher(&ifxdeu_ecb_arc4_alg); printk (KERN_ERR "IFX ecb_arc4 initialization failed!\n"); return ret; @@ -383,9 +381,7 @@ ecb_arc4_err: void ifxdeu_fini_arc4(void) { crypto_unregister_alg (&ifxdeu_arc4_alg); - crypto_unregister_alg (&ifxdeu_ecb_arc4_alg); + crypto_unregister_skcipher (&ifxdeu_ecb_arc4_alg); } - - diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_async_aes.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_async_aes.c index dcd059371f..8184fed71f 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_async_aes.c +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_async_aes.c @@ -964,7 +964,7 @@ static struct lq_aes_alg aes_drivers_alg[] = { .alg = { .cra_name = "aes", .cra_driver_name = "ifxdeu-aes", - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, + .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC, .cra_blocksize = AES_BLOCK_SIZE, .cra_ctxsize = sizeof(struct aes_ctx), .cra_type = &crypto_ablkcipher_type, @@ -984,7 +984,7 @@ static struct lq_aes_alg aes_drivers_alg[] = { .alg = { .cra_name = "ecb(aes)", .cra_driver_name = "ifxdeu-ecb(aes)", - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, + .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC, .cra_blocksize = AES_BLOCK_SIZE, .cra_ctxsize = sizeof(struct aes_ctx), .cra_type = &crypto_ablkcipher_type, @@ -1004,7 +1004,7 @@ static struct lq_aes_alg aes_drivers_alg[] = { .alg = { .cra_name = "cbc(aes)", .cra_driver_name = "ifxdeu-cbc(aes)", - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, + .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC, .cra_blocksize = AES_BLOCK_SIZE, .cra_ctxsize = sizeof(struct aes_ctx), .cra_type = &crypto_ablkcipher_type, @@ -1024,7 +1024,7 @@ static struct lq_aes_alg aes_drivers_alg[] = { .alg = { .cra_name = "ctr(aes)", .cra_driver_name = "ifxdeu-ctr(aes)", - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, + .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC, .cra_blocksize = AES_BLOCK_SIZE, .cra_ctxsize = sizeof(struct aes_ctx), .cra_type = &crypto_ablkcipher_type, @@ -1044,7 +1044,7 @@ static struct lq_aes_alg aes_drivers_alg[] = { .alg = { .cra_name = "rfc3686(ctr(aes))", .cra_driver_name = "ifxdeu-rfc3686(ctr(aes))", - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, + .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC, .cra_blocksize = AES_BLOCK_SIZE, .cra_ctxsize = sizeof(struct aes_ctx), .cra_type = &crypto_ablkcipher_type, diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_async_des.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_async_des.c index 1523763ccd..bd560bf659 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_async_des.c +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_async_des.c @@ -761,7 +761,7 @@ static struct lq_des_alg des_drivers_alg [] = { .alg = { .cra_name = "des", .cra_driver_name = "lqdeu-des", - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, + .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC, .cra_blocksize = DES_BLOCK_SIZE, .cra_ctxsize = sizeof(struct des_ctx), .cra_type = &crypto_ablkcipher_type, @@ -782,7 +782,7 @@ static struct lq_des_alg des_drivers_alg [] = { .alg = { .cra_name = "ecb(des)", .cra_driver_name = "lqdeu-ecb(des)", - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, + .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC, .cra_blocksize = DES_BLOCK_SIZE, .cra_ctxsize = sizeof(struct des_ctx), .cra_type = &crypto_ablkcipher_type, @@ -802,7 +802,7 @@ static struct lq_des_alg des_drivers_alg [] = { .alg = { .cra_name = "cbc(des)", .cra_driver_name = "lqdeu-cbc(des)", - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, + .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC, .cra_blocksize = DES_BLOCK_SIZE, .cra_ctxsize = sizeof(struct des_ctx), .cra_type = &crypto_ablkcipher_type, @@ -822,7 +822,7 @@ static struct lq_des_alg des_drivers_alg [] = { .alg = { .cra_name = "des3_ede", .cra_driver_name = "lqdeu-des3_ede", - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, + .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC, .cra_blocksize = DES_BLOCK_SIZE, .cra_ctxsize = sizeof(struct des_ctx), .cra_type = &crypto_ablkcipher_type, @@ -842,7 +842,7 @@ static struct lq_des_alg des_drivers_alg [] = { .alg = { .cra_name = "ecb(des3_ede)", .cra_driver_name = "lqdeu-ecb(des3_ede)", - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, + .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC, .cra_blocksize = DES_BLOCK_SIZE, .cra_ctxsize = sizeof(struct des_ctx), .cra_type = &crypto_ablkcipher_type, @@ -862,7 +862,7 @@ static struct lq_des_alg des_drivers_alg [] = { .alg = { .cra_name = "cbc(des3_ede)", .cra_driver_name = "lqdeu-cbc(des3_ede)", - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, + .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC, .cra_blocksize = DES_BLOCK_SIZE, .cra_ctxsize = sizeof(struct des_ctx), .cra_type = &crypto_ablkcipher_type, diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_des.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_des.c index 6d7d82fcb9..8c12a26070 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_des.c +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_des.c @@ -50,6 +50,8 @@ #include #include #include +#include +#include #include "ifxmips_deu.h" #if defined(CONFIG_DANUBE) @@ -105,17 +107,18 @@ void des_dma_memory_copy(u32 *outcopy, u32 *out_dma, u8 *out_arg, int nbytes); void ifx_deu_des (void *ctx_arg, u8 *out_arg, const u8 *in_arg, u8 *iv_arg, u32 nbytes, int encdec, int mode); -struct des_ctx { +struct ifx_deu_des_ctx { int controlr_M; int key_length; u8 iv[DES_BLOCK_SIZE]; u32 expkey[DES3_EDE_EXPKEY_WORDS]; + struct des_ctx des_context; + struct des3_ede_ctx des3_ede_context; }; extern int disable_multiblock; extern int disable_deudma; - /*! \fn int des_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) * \ingroup IFX_DES_FUNCTIONS * \brief sets DES key @@ -126,18 +129,42 @@ extern int disable_deudma; int des_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) { - struct des_ctx *dctx = crypto_tfm_ctx(tfm); + struct ifx_deu_des_ctx *dctx = crypto_tfm_ctx(tfm); + int err; //printk("setkey in %s\n", __FILE__); + err = des_expand_key(&dctx->des_context, key, keylen); + if (err == -ENOKEY) { + if (crypto_tfm_get_flags(tfm) & CRYPTO_TFM_REQ_FORBID_WEAK_KEYS) + err = -EINVAL; + else + err = 0; + } + dctx->controlr_M = 0; // des dctx->key_length = keylen; memcpy ((u8 *) (dctx->expkey), key, keylen); - return 0; + if (err) + memset(dctx, 0, sizeof(*dctx)); + + return err; } +/*! \fn int des_setkey_skcipher (struct crypto_skcipher *tfm, const uint8_t *in_key, unsigned int key_len) + * \ingroup IFX_AES_FUNCTIONS + * \brief sets the AES keys for skcipher + * \param tfm linux crypto skcipher + * \param in_key input key + * \param key_len key lengths of 16, 24 and 32 bytes supported + * \return -EINVAL - bad key length, 0 - SUCCESS +*/ +int des_setkey_skcipher (struct crypto_skcipher *tfm, const u8 *in_key, unsigned int key_len) +{ + return des_setkey(crypto_skcipher_tfm(tfm), in_key, key_len); +} /*! \fn void ifx_deu_des(void *ctx_arg, u8 *out_arg, const u8 *in_arg, u8 *iv_arg, u32 nbytes, int encdec, int mode) * \ingroup IFX_DES_FUNCTIONS @@ -155,7 +182,7 @@ void ifx_deu_des (void *ctx_arg, u8 *out_arg, const u8 *in_arg, u8 *iv_arg, u32 nbytes, int encdec, int mode) { volatile struct des_t *des = (struct des_t *) DES_3DES_START; - struct des_ctx *dctx = ctx_arg; + struct ifx_deu_des_ctx *dctx = ctx_arg; u32 *key = dctx->expkey; unsigned long flag; @@ -257,8 +284,6 @@ void ifx_deu_des (void *ctx_arg, u8 *out_arg, const u8 *in_arg, * \param mode operation mode such as ebc, cbc */ - - /*! \fn void ifx_deu_des_ecb (void *ctx, uint8_t *dst, const uint8_t *src, uint8_t *iv, size_t nbytes, int encdec, int inplace) * \ingroup IFX_DES_FUNCTIONS * \brief sets DES hardware to ECB mode @@ -270,7 +295,6 @@ void ifx_deu_des (void *ctx_arg, u8 *out_arg, const u8 *in_arg, * \param encdec 1 for encrypt; 0 for decrypt * \param inplace not used */ - void ifx_deu_des_ecb (void *ctx, uint8_t *dst, const uint8_t *src, uint8_t *iv, size_t nbytes, int encdec, int inplace) { @@ -345,31 +369,31 @@ void ifx_deu_des_ctr (void *ctx, uint8_t *dst, const uint8_t *src, ifx_deu_des (ctx, dst, src, iv, nbytes, encdec, 4); } -/*! \fn void des_encrypt (struct crypto_tfm *tfm, uint8_t *out, const uint8_t *in) +/*! \fn void ifx_deu_des_encrypt (struct crypto_tfm *tfm, uint8_t *out, const uint8_t *in) * \ingroup IFX_DES_FUNCTIONS * \brief encrypt DES_BLOCK_SIZE of data * \param tfm linux crypto algo transform * \param out output bytestream * \param in input bytestream */ -void des_encrypt (struct crypto_tfm *tfm, uint8_t * out, const uint8_t * in) +void ifx_deu_des_encrypt (struct crypto_tfm *tfm, uint8_t * out, const uint8_t * in) { - struct des_ctx *ctx = crypto_tfm_ctx(tfm); + struct ifx_deu_des_ctx *ctx = crypto_tfm_ctx(tfm); ifx_deu_des (ctx, out, in, NULL, DES_BLOCK_SIZE, CRYPTO_DIR_ENCRYPT, 0); } -/*! \fn void des_decrypt (struct crypto_tfm *tfm, uint8_t *out, const uint8_t *in) +/*! \fn void ifx_deu_des_decrypt (struct crypto_tfm *tfm, uint8_t *out, const uint8_t *in) * \ingroup IFX_DES_FUNCTIONS * \brief encrypt DES_BLOCK_SIZE of data * \param tfm linux crypto algo transform * \param out output bytestream * \param in input bytestream */ -void des_decrypt (struct crypto_tfm *tfm, uint8_t * out, const uint8_t * in) +void ifx_deu_des_decrypt (struct crypto_tfm *tfm, uint8_t * out, const uint8_t * in) { - struct des_ctx *ctx = crypto_tfm_ctx(tfm); + struct ifx_deu_des_ctx *ctx = crypto_tfm_ctx(tfm); ifx_deu_des (ctx, out, in, NULL, DES_BLOCK_SIZE, CRYPTO_DIR_DECRYPT, 0); } @@ -398,16 +422,41 @@ void des_decrypt (struct crypto_tfm *tfm, uint8_t * out, const uint8_t * in) int des3_ede_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) { - struct des_ctx *dctx = crypto_tfm_ctx(tfm); + struct ifx_deu_des_ctx *dctx = crypto_tfm_ctx(tfm); + int err; //printk("setkey in %s\n", __FILE__); + err = des3_ede_expand_key(&dctx->des3_ede_context, key, keylen); + if (err == -ENOKEY) { + if (crypto_tfm_get_flags(tfm) & CRYPTO_TFM_REQ_FORBID_WEAK_KEYS) + err = -EINVAL; + else + err = 0; + } + dctx->controlr_M = keylen / 8 + 1; // 3DES EDE1 / EDE2 / EDE3 Mode dctx->key_length = keylen; memcpy ((u8 *) (dctx->expkey), key, keylen); - return 0; + if (err) + memset(dctx, 0, sizeof(*dctx)); + + return err; +} + +/*! \fn int des3_ede_setkey_skcipher(struct crypto_skcipher *tfm, const u8 *key, unsigned int keylen) + * \ingroup IFX_DES_FUNCTIONS + * \brief sets 3DES key + * \param tfm linux crypto skcipher transform + * \param key input key + * \param keylen key length +*/ +int des3_ede_setkey_skcipher(struct crypto_skcipher *tfm, const u8 *key, + unsigned int keylen) +{ + return des3_ede_setkey(crypto_skcipher_tfm(tfm), key, keylen); } /* @@ -417,9 +466,9 @@ struct crypto_alg ifxdeu_des_alg = { .cra_name = "des", .cra_driver_name = "ifxdeu-des", .cra_priority = 300, - .cra_flags = CRYPTO_ALG_TYPE_CIPHER, + .cra_flags = CRYPTO_ALG_TYPE_CIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY, .cra_blocksize = DES_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct des_ctx), + .cra_ctxsize = sizeof(struct ifx_deu_des_ctx), .cra_module = THIS_MODULE, .cra_alignmask = 3, .cra_list = LIST_HEAD_INIT(ifxdeu_des_alg.cra_list), @@ -427,8 +476,8 @@ struct crypto_alg ifxdeu_des_alg = { .cia_min_keysize = DES_KEY_SIZE, .cia_max_keysize = DES_KEY_SIZE, .cia_setkey = des_setkey, - .cia_encrypt = des_encrypt, - .cia_decrypt = des_decrypt } } + .cia_encrypt = ifx_deu_des_encrypt, + .cia_decrypt = ifx_deu_des_decrypt } } }; /* @@ -438,79 +487,68 @@ struct crypto_alg ifxdeu_des3_ede_alg = { .cra_name = "des3_ede", .cra_driver_name = "ifxdeu-des3_ede", .cra_priority = 300, - .cra_flags = CRYPTO_ALG_TYPE_CIPHER, - .cra_blocksize = DES_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct des_ctx), + .cra_flags = CRYPTO_ALG_TYPE_CIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY, + .cra_blocksize = DES3_EDE_BLOCK_SIZE, + .cra_ctxsize = sizeof(struct ifx_deu_des_ctx), .cra_module = THIS_MODULE, .cra_alignmask = 3, .cra_list = LIST_HEAD_INIT(ifxdeu_des3_ede_alg.cra_list), .cra_u = { .cipher = { - .cia_min_keysize = DES_KEY_SIZE, - .cia_max_keysize = DES_KEY_SIZE, + .cia_min_keysize = DES3_EDE_KEY_SIZE, + .cia_max_keysize = DES3_EDE_KEY_SIZE, .cia_setkey = des3_ede_setkey, - .cia_encrypt = des_encrypt, - .cia_decrypt = des_decrypt } } + .cia_encrypt = ifx_deu_des_encrypt, + .cia_decrypt = ifx_deu_des_decrypt } } }; -/*! \fn int ecb_des_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) - * \ingroup IFX_DES_FUNCTIONS - * \brief ECB DES encrypt using linux crypto blkcipher - * \param desc blkcipher descriptor - * \param dst output scatterlist - * \param src input scatterlist - * \param nbytes data size in bytes -*/ -int ecb_des_encrypt(struct blkcipher_desc *desc, - struct scatterlist *dst, struct scatterlist *src, - unsigned int nbytes) +/*! \fn int ecb_des_encrypt(struct skcipher_req *req) + * \ingroup IFX_AES_FUNCTIONS + * \brief ECB DES encrypt using linux crypto skcipher + * \param req skcipher request + * \return err +*/ +int ecb_des_encrypt(struct skcipher_request *req) { - struct des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - struct blkcipher_walk walk; + struct ifx_deu_des_ctx *ctx = crypto_tfm_ctx(req->base.tfm); + struct skcipher_walk walk; int err; - unsigned int enc_bytes; + unsigned int enc_bytes, nbytes; - blkcipher_walk_init(&walk, dst, src, nbytes); - err = blkcipher_walk_virt(desc, &walk); + err = skcipher_walk_virt(&walk, req, false); while ((nbytes = enc_bytes = walk.nbytes)) { enc_bytes -= (nbytes % DES_BLOCK_SIZE); ifx_deu_des_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr, NULL, enc_bytes, CRYPTO_DIR_ENCRYPT, 0); nbytes &= DES_BLOCK_SIZE - 1; - err = blkcipher_walk_done(desc, &walk, nbytes); + err = skcipher_walk_done(&walk, nbytes); } return err; } -/*! \fn int ecb_des_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) - * \ingroup IFX_DES_FUNCTIONS - * \brief ECB DES decrypt using linux crypto blkcipher - * \param desc blkcipher descriptor - * \param dst output scatterlist - * \param src input scatterlist - * \param nbytes data size in bytes +/*! \fn int ecb_des_decrypt(struct skcipher_req *req) + * \ingroup IFX_AES_FUNCTIONS + * \brief ECB DES decrypt using linux crypto skcipher + * \param req skcipher request * \return err -*/ -int ecb_des_decrypt(struct blkcipher_desc *desc, - struct scatterlist *dst, struct scatterlist *src, - unsigned int nbytes) +*/ +int ecb_des_decrypt(struct skcipher_request *req) { - struct des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - struct blkcipher_walk walk; + struct ifx_deu_des_ctx *ctx = crypto_tfm_ctx(req->base.tfm); + struct skcipher_walk walk; int err; - unsigned int dec_bytes; + unsigned int dec_bytes, nbytes; DPRINTF(1, "\n"); - blkcipher_walk_init(&walk, dst, src, nbytes); - err = blkcipher_walk_virt(desc, &walk); + err = skcipher_walk_virt(&walk, req, false); while ((nbytes = dec_bytes = walk.nbytes)) { dec_bytes -= (nbytes % DES_BLOCK_SIZE); ifx_deu_des_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr, NULL, dec_bytes, CRYPTO_DIR_DECRYPT, 0); nbytes &= DES_BLOCK_SIZE - 1; - err = blkcipher_walk_done(desc, &walk, nbytes); + err = skcipher_walk_done(&walk, nbytes); } return err; @@ -518,73 +556,57 @@ int ecb_des_decrypt(struct blkcipher_desc *desc, /* * \brief DES function mappings -*/ -struct crypto_alg ifxdeu_ecb_des_alg = { - .cra_name = "ecb(des)", - .cra_driver_name = "ifxdeu-ecb(des)", - .cra_priority = 400, - .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, - .cra_blocksize = DES_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct des_ctx), - .cra_type = &crypto_blkcipher_type, - .cra_module = THIS_MODULE, - .cra_list = LIST_HEAD_INIT(ifxdeu_ecb_des_alg.cra_list), - .cra_u = { - .blkcipher = { - .min_keysize = DES_KEY_SIZE, - .max_keysize = DES_KEY_SIZE, - .setkey = des_setkey, - .encrypt = ecb_des_encrypt, - .decrypt = ecb_des_decrypt, - } - } +*/ +struct skcipher_alg ifxdeu_ecb_des_alg = { + .base.cra_name = "ecb(des)", + .base.cra_driver_name = "ifxdeu-ecb(des)", + .base.cra_priority = 400, + .base.cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY, + .base.cra_blocksize = DES_BLOCK_SIZE, + .base.cra_ctxsize = sizeof(struct ifx_deu_des_ctx), + .base.cra_module = THIS_MODULE, + .base.cra_list = LIST_HEAD_INIT(ifxdeu_ecb_des_alg.base.cra_list), + .min_keysize = DES_KEY_SIZE, + .max_keysize = DES_KEY_SIZE, + .setkey = des_setkey_skcipher, + .encrypt = ecb_des_encrypt, + .decrypt = ecb_des_decrypt, }; /* * \brief DES function mappings -*/ -struct crypto_alg ifxdeu_ecb_des3_ede_alg = { - .cra_name = "ecb(des3_ede)", - .cra_driver_name = "ifxdeu-ecb(des3_ede)", - .cra_priority = 400, - .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, - .cra_blocksize = DES3_EDE_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct des_ctx), - .cra_type = &crypto_blkcipher_type, - .cra_module = THIS_MODULE, - .cra_list = LIST_HEAD_INIT(ifxdeu_ecb_des3_ede_alg.cra_list), - .cra_u = { - .blkcipher = { - .min_keysize = DES3_EDE_KEY_SIZE, - .max_keysize = DES3_EDE_KEY_SIZE, - .setkey = des3_ede_setkey, - .encrypt = ecb_des_encrypt, - .decrypt = ecb_des_decrypt, - } - } +*/ +struct skcipher_alg ifxdeu_ecb_des3_ede_alg = { + .base.cra_name = "ecb(des3_ede)", + .base.cra_driver_name = "ifxdeu-ecb(des3_ede)", + .base.cra_priority = 400, + .base.cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY, + .base.cra_blocksize = DES3_EDE_BLOCK_SIZE, + .base.cra_ctxsize = sizeof(struct ifx_deu_des_ctx), + .base.cra_module = THIS_MODULE, + .base.cra_list = LIST_HEAD_INIT(ifxdeu_ecb_des3_ede_alg.base.cra_list), + .min_keysize = DES3_EDE_KEY_SIZE, + .max_keysize = DES3_EDE_KEY_SIZE, + .setkey = des3_ede_setkey_skcipher, + .encrypt = ecb_des_encrypt, + .decrypt = ecb_des_decrypt, }; -/*! \fn int cbc_des_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) - * \ingroup IFX_DES_FUNCTIONS - * \brief CBC DES encrypt using linux crypto blkcipher - * \param desc blkcipher descriptor - * \param dst output scatterlist - * \param src input scatterlist - * \param nbytes data size in bytes +/*! \fn int cbc_des_encrypt(struct skcipher_req *req) + * \ingroup IFX_AES_FUNCTIONS + * \brief CBC DES encrypt using linux crypto skcipher + * \param req skcipher request * \return err -*/ -int cbc_des_encrypt(struct blkcipher_desc *desc, - struct scatterlist *dst, struct scatterlist *src, - unsigned int nbytes) +*/ +int cbc_des_encrypt(struct skcipher_request *req) { - struct des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - struct blkcipher_walk walk; + struct ifx_deu_des_ctx *ctx = crypto_tfm_ctx(req->base.tfm); + struct skcipher_walk walk; int err; - unsigned int enc_bytes; + unsigned int enc_bytes, nbytes; DPRINTF(1, "\n"); - blkcipher_walk_init(&walk, dst, src, nbytes); - err = blkcipher_walk_virt(desc, &walk); + err = skcipher_walk_virt(&walk, req, false); while ((nbytes = enc_bytes = walk.nbytes)) { u8 *iv = walk.iv; @@ -592,33 +614,27 @@ int cbc_des_encrypt(struct blkcipher_desc *desc, ifx_deu_des_cbc(ctx, walk.dst.virt.addr, walk.src.virt.addr, iv, enc_bytes, CRYPTO_DIR_ENCRYPT, 0); nbytes &= DES_BLOCK_SIZE - 1; - err = blkcipher_walk_done(desc, &walk, nbytes); + err = skcipher_walk_done(&walk, nbytes); } return err; } -/*! \fn int cbc_des_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) - * \ingroup IFX_DES_FUNCTIONS - * \brief CBC DES decrypt using linux crypto blkcipher - * \param desc blkcipher descriptor - * \param dst output scatterlist - * \param src input scatterlist - * \param nbytes data size in bytes +/*! \fn int cbc_des_encrypt(struct skcipher_req *req) + * \ingroup IFX_AES_FUNCTIONS + * \brief CBC DES decrypt using linux crypto skcipher + * \param req skcipher request * \return err -*/ -int cbc_des_decrypt(struct blkcipher_desc *desc, - struct scatterlist *dst, struct scatterlist *src, - unsigned int nbytes) +*/ +int cbc_des_decrypt(struct skcipher_request *req) { - struct des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - struct blkcipher_walk walk; + struct ifx_deu_des_ctx *ctx = crypto_tfm_ctx(req->base.tfm); + struct skcipher_walk walk; int err; - unsigned int dec_bytes; + unsigned int dec_bytes, nbytes; DPRINTF(1, "\n"); - blkcipher_walk_init(&walk, dst, src, nbytes); - err = blkcipher_walk_virt(desc, &walk); + err = skcipher_walk_virt(&walk, req, false); while ((nbytes = dec_bytes = walk.nbytes)) { u8 *iv = walk.iv; @@ -626,7 +642,7 @@ int cbc_des_decrypt(struct blkcipher_desc *desc, ifx_deu_des_cbc(ctx, walk.dst.virt.addr, walk.src.virt.addr, iv, dec_bytes, CRYPTO_DIR_DECRYPT, 0); nbytes &= DES_BLOCK_SIZE - 1; - err = blkcipher_walk_done(desc, &walk, nbytes); + err = skcipher_walk_done(&walk, nbytes); } return err; @@ -634,52 +650,42 @@ int cbc_des_decrypt(struct blkcipher_desc *desc, /* * \brief DES function mappings -*/ -struct crypto_alg ifxdeu_cbc_des_alg = { - .cra_name = "cbc(des)", - .cra_driver_name = "ifxdeu-cbc(des)", - .cra_priority = 400, - .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, - .cra_blocksize = DES_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct des_ctx), - .cra_type = &crypto_blkcipher_type, - .cra_module = THIS_MODULE, - .cra_list = LIST_HEAD_INIT(ifxdeu_cbc_des_alg.cra_list), - .cra_u = { - .blkcipher = { - .min_keysize = DES_KEY_SIZE, - .max_keysize = DES_KEY_SIZE, - .ivsize = DES_BLOCK_SIZE, - .setkey = des_setkey, - .encrypt = cbc_des_encrypt, - .decrypt = cbc_des_decrypt, - } - } +*/ +struct skcipher_alg ifxdeu_cbc_des_alg = { + .base.cra_name = "cbc(des)", + .base.cra_driver_name = "ifxdeu-cbc(des)", + .base.cra_priority = 400, + .base.cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY, + .base.cra_blocksize = DES_BLOCK_SIZE, + .base.cra_ctxsize = sizeof(struct ifx_deu_des_ctx), + .base.cra_module = THIS_MODULE, + .base.cra_list = LIST_HEAD_INIT(ifxdeu_cbc_des_alg.base.cra_list), + .min_keysize = DES_KEY_SIZE, + .max_keysize = DES_KEY_SIZE, + .ivsize = DES_BLOCK_SIZE, + .setkey = des_setkey_skcipher, + .encrypt = cbc_des_encrypt, + .decrypt = cbc_des_decrypt, }; /* * \brief DES function mappings -*/ -struct crypto_alg ifxdeu_cbc_des3_ede_alg = { - .cra_name = "cbc(des3_ede)", - .cra_driver_name = "ifxdeu-cbc(des3_ede)", - .cra_priority = 400, - .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, - .cra_blocksize = DES3_EDE_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct des_ctx), - .cra_type = &crypto_blkcipher_type, - .cra_module = THIS_MODULE, - .cra_list = LIST_HEAD_INIT(ifxdeu_cbc_des3_ede_alg.cra_list), - .cra_u = { - .blkcipher = { - .min_keysize = DES3_EDE_KEY_SIZE, - .max_keysize = DES3_EDE_KEY_SIZE, - .ivsize = DES_BLOCK_SIZE, - .setkey = des3_ede_setkey, - .encrypt = cbc_des_encrypt, - .decrypt = cbc_des_decrypt, - } - } +*/ +struct skcipher_alg ifxdeu_cbc_des3_ede_alg = { + .base.cra_name = "cbc(des3_ede)", + .base.cra_driver_name = "ifxdeu-cbc(des3_ede)", + .base.cra_priority = 400, + .base.cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY, + .base.cra_blocksize = DES3_EDE_BLOCK_SIZE, + .base.cra_ctxsize = sizeof(struct ifx_deu_des_ctx), + .base.cra_module = THIS_MODULE, + .base.cra_list = LIST_HEAD_INIT(ifxdeu_cbc_des3_ede_alg.base.cra_list), + .min_keysize = DES3_EDE_KEY_SIZE, + .max_keysize = DES3_EDE_KEY_SIZE, + .ivsize = DES_BLOCK_SIZE, + .setkey = des3_ede_setkey_skcipher, + .encrypt = cbc_des_encrypt, + .decrypt = cbc_des_decrypt, }; /*! \fn int ifxdeu_init_des (void) @@ -690,16 +696,17 @@ int ifxdeu_init_des (void) { int ret = -ENOSYS; + des_chip_init(); ret = crypto_register_alg(&ifxdeu_des_alg); if (ret < 0) goto des_err; - ret = crypto_register_alg(&ifxdeu_ecb_des_alg); + ret = crypto_register_skcipher(&ifxdeu_ecb_des_alg); if (ret < 0) goto ecb_des_err; - ret = crypto_register_alg(&ifxdeu_cbc_des_alg); + ret = crypto_register_skcipher(&ifxdeu_cbc_des_alg); if (ret < 0) goto cbc_des_err; @@ -707,15 +714,14 @@ int ifxdeu_init_des (void) if (ret < 0) goto des3_ede_err; - ret = crypto_register_alg(&ifxdeu_ecb_des3_ede_alg); + ret = crypto_register_skcipher(&ifxdeu_ecb_des3_ede_alg); if (ret < 0) goto ecb_des3_ede_err; - ret = crypto_register_alg(&ifxdeu_cbc_des3_ede_alg); + ret = crypto_register_skcipher(&ifxdeu_cbc_des3_ede_alg); if (ret < 0) goto cbc_des3_ede_err; - des_chip_init(); CRTCL_SECT_INIT; @@ -728,11 +734,11 @@ des_err: printk(KERN_ERR "IFX des initialization failed!\n"); return ret; ecb_des_err: - crypto_unregister_alg(&ifxdeu_ecb_des_alg); + crypto_unregister_skcipher(&ifxdeu_ecb_des_alg); printk (KERN_ERR "IFX ecb_des initialization failed!\n"); return ret; cbc_des_err: - crypto_unregister_alg(&ifxdeu_cbc_des_alg); + crypto_unregister_skcipher(&ifxdeu_cbc_des_alg); printk (KERN_ERR "IFX cbc_des initialization failed!\n"); return ret; des3_ede_err: @@ -740,11 +746,11 @@ des3_ede_err: printk(KERN_ERR "IFX des3_ede initialization failed!\n"); return ret; ecb_des3_ede_err: - crypto_unregister_alg(&ifxdeu_ecb_des3_ede_alg); + crypto_unregister_skcipher(&ifxdeu_ecb_des3_ede_alg); printk (KERN_ERR "IFX ecb_des3_ede initialization failed!\n"); return ret; cbc_des3_ede_err: - crypto_unregister_alg(&ifxdeu_cbc_des3_ede_alg); + crypto_unregister_skcipher(&ifxdeu_cbc_des3_ede_alg); printk (KERN_ERR "IFX cbc_des3_ede initialization failed!\n"); return ret; @@ -757,11 +763,10 @@ cbc_des3_ede_err: void ifxdeu_fini_des (void) { crypto_unregister_alg (&ifxdeu_des_alg); - crypto_unregister_alg (&ifxdeu_ecb_des_alg); - crypto_unregister_alg (&ifxdeu_cbc_des_alg); + crypto_unregister_skcipher (&ifxdeu_ecb_des_alg); + crypto_unregister_skcipher (&ifxdeu_cbc_des_alg); crypto_unregister_alg (&ifxdeu_des3_ede_alg); - crypto_unregister_alg (&ifxdeu_ecb_des3_ede_alg); - crypto_unregister_alg (&ifxdeu_cbc_des3_ede_alg); + crypto_unregister_skcipher (&ifxdeu_ecb_des3_ede_alg); + crypto_unregister_skcipher (&ifxdeu_cbc_des3_ede_alg); } - diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_deu.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_deu.c index 3947b31a40..a102568f97 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_deu.c +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_deu.c @@ -69,6 +69,8 @@ #endif /* CONFIG_xxxx */ int disable_deudma = 1; +spinlock_t ltq_deu_hash_lock; +EXPORT_SYMBOL_GPL(ltq_deu_hash_lock); void chip_version(void); @@ -84,6 +86,7 @@ static int ltq_deu_probe(struct platform_device *pdev) START_DEU_POWER; + CRTCL_SECT_HASH_INIT; #define IFX_DEU_DRV_VERSION "2.0.0" printk(KERN_INFO "Infineon Technologies DEU driver version %s \n", IFX_DEU_DRV_VERSION); diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_deu.h b/package/kernel/lantiq/ltq-deu/src/ifxmips_deu.h index 8045c2081a..3c994cb346 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_deu.h +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_deu.h @@ -131,6 +131,10 @@ void __exit lqdeu_fini_async_des(void); void __exit deu_fini (void); int deu_dma_init (void); +extern spinlock_t ltq_deu_hash_lock; +#define CRTCL_SECT_HASH_INIT spin_lock_init(<q_deu_hash_lock) +#define CRTCL_SECT_HASH_START spin_lock_irqsave(<q_deu_hash_lock, flag) +#define CRTCL_SECT_HASH_END spin_unlock_irqrestore(<q_deu_hash_lock, flag) #define DEU_WAKELIST_INIT(queue) \ diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_ar9.h b/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_ar9.h index 69414553de..2f373589a5 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_ar9.h +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_ar9.h @@ -117,6 +117,14 @@ hash->controlr.INIT = 1; \ } while(0) +#define MD5_HASH_INIT \ + do { \ + volatile struct deu_hash_t *hash = (struct deu_hash_t *) HASH_START; \ + hash->controlr.SM = 1; \ + hash->controlr.ALGO = 1; \ + hash->controlr.INIT = 1; \ + } while(0) + /* DEU Common Structures for AR9*/ struct clc_controlr_t { diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_danube.h b/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_danube.h index 25efa04a69..25561cf6e0 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_danube.h +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_danube.h @@ -104,6 +104,14 @@ hash->controlr.INIT = 1; \ } while(0) +#define MD5_HASH_INIT \ + do { \ + volatile struct deu_hash_t *hash = (struct deu_hash_t *) HASH_START; \ + hash->controlr.SM = 1; \ + hash->controlr.ALGO = 1; \ + hash->controlr.INIT = 1; \ + } while(0) + /* DEU STRUCTURES */ struct clc_controlr_t { diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_vr9.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_vr9.c index aaa7bce237..8063672613 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_vr9.c +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_vr9.c @@ -107,7 +107,7 @@ void aes_chip_init (void) // start crypto engine with write to ILR aes->controlr.SM = 1; - aes->controlr.NDC = 0; + aes->controlr.NDC = 1; asm("sync"); aes->controlr.ENDI = 1; asm("sync"); diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c index 11cb64799e..51782e0b6a 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c @@ -64,11 +64,6 @@ #define MD5_HASH_WORDS 4 #define HASH_START IFX_HASH_CON -static spinlock_t lock; -#define CRTCL_SECT_INIT spin_lock_init(&lock) -#define CRTCL_SECT_START spin_lock_irqsave(&lock, flag) -#define CRTCL_SECT_END spin_unlock_irqrestore(&lock, flag) - //#define CRYPTO_DEBUG #ifdef CRYPTO_DEBUG extern char debug_level; @@ -86,18 +81,6 @@ struct md5_ctx { extern int disable_deudma; -/*! \fn static u32 endian_swap(u32 input) - * \ingroup IFX_MD5_FUNCTIONS - * \brief perform dword level endian swap - * \param input value of dword that requires to be swapped -*/ -static u32 endian_swap(u32 input) -{ - u8 *ptr = (u8 *)&input; - - return ((ptr[3] << 24) | (ptr[2] << 16) | (ptr[1] << 8) | ptr[0]); -} - /*! \fn static void md5_transform(u32 *hash, u32 const *in) * \ingroup IFX_MD5_FUNCTIONS * \brief main interface to md5 hardware @@ -110,18 +93,20 @@ static void md5_transform(struct md5_ctx *mctx, u32 *hash, u32 const *in) volatile struct deu_hash_t *hashs = (struct deu_hash_t *) HASH_START; unsigned long flag; - CRTCL_SECT_START; + CRTCL_SECT_HASH_START; + + MD5_HASH_INIT; if (mctx->started) { - hashs->D1R = endian_swap(*((u32 *) hash + 0)); - hashs->D2R = endian_swap(*((u32 *) hash + 1)); - hashs->D3R = endian_swap(*((u32 *) hash + 2)); - hashs->D4R = endian_swap(*((u32 *) hash + 3)); + hashs->D1R = *((u32 *) hash + 0); + hashs->D2R = *((u32 *) hash + 1); + hashs->D3R = *((u32 *) hash + 2); + hashs->D4R = *((u32 *) hash + 3); } for (i = 0; i < 16; i++) { - hashs->MR = endian_swap(in[i]); -// printk("in[%d]: %08x\n", i, endian_swap(in[i])); + hashs->MR = in[i]; +// printk("in[%d]: %08x\n", i, in[i]); }; //wait for processing @@ -129,14 +114,14 @@ static void md5_transform(struct md5_ctx *mctx, u32 *hash, u32 const *in) // this will not take long } - *((u32 *) hash + 0) = endian_swap (hashs->D1R); - *((u32 *) hash + 1) = endian_swap (hashs->D2R); - *((u32 *) hash + 2) = endian_swap (hashs->D3R); - *((u32 *) hash + 3) = endian_swap (hashs->D4R); + *((u32 *) hash + 0) = hashs->D1R; + *((u32 *) hash + 1) = hashs->D2R; + *((u32 *) hash + 2) = hashs->D3R; + *((u32 *) hash + 3) = hashs->D4R; - mctx->started = 1; + CRTCL_SECT_HASH_END; - CRTCL_SECT_END; + mctx->started = 1; } /*! \fn static inline void md5_transform_helper(struct md5_ctx *ctx) @@ -160,11 +145,6 @@ static int md5_init(struct shash_desc *desc) struct md5_ctx *mctx = shash_desc_ctx(desc); volatile struct deu_hash_t *hash = (struct deu_hash_t *) HASH_START; - hash->controlr.ENDI = 0; - hash->controlr.SM = 1; - hash->controlr.ALGO = 1; // 1 = md5 0 = sha1 - hash->controlr.INIT = 1; // Initialize the hash operation by writing a '1' to the INIT bit. - mctx->byte_count = 0; mctx->started = 0; return 0; @@ -232,24 +212,12 @@ static int md5_final(struct shash_desc *desc, u8 *out) } memset(p, 0, padding); - mctx->block[14] = endian_swap(mctx->byte_count << 3); - mctx->block[15] = endian_swap(mctx->byte_count >> 29); - -#if 0 - le32_to_cpu_array(mctx->block, (sizeof(mctx->block) - - sizeof(u64)) / sizeof(u32)); -#endif + mctx->block[14] = le32_to_cpu(mctx->byte_count << 3); + mctx->block[15] = le32_to_cpu(mctx->byte_count >> 29); md5_transform(mctx, mctx->hash, mctx->block); - CRTCL_SECT_START; - - *((u32 *) out + 0) = endian_swap (hashs->D1R); - *((u32 *) out + 1) = endian_swap (hashs->D2R); - *((u32 *) out + 2) = endian_swap (hashs->D3R); - *((u32 *) out + 3) = endian_swap (hashs->D4R); - - CRTCL_SECT_END; + memcpy(out, mctx->hash, MD5_DIGEST_SIZE); // Wipe context memset(mctx, 0, sizeof(*mctx)); @@ -270,7 +238,7 @@ static struct shash_alg ifxdeu_md5_alg = { .cra_name = "md5", .cra_driver_name= "ifxdeu-md5", .cra_priority = 300, - .cra_flags = CRYPTO_ALG_TYPE_HASH, + .cra_flags = CRYPTO_ALG_TYPE_HASH | CRYPTO_ALG_KERN_DRIVER_ONLY, .cra_blocksize = MD5_HMAC_BLOCK_SIZE, .cra_module = THIS_MODULE, } @@ -288,8 +256,6 @@ int ifxdeu_init_md5 (void) if ((ret = crypto_register_shash(&ifxdeu_md5_alg))) goto md5_err; - CRTCL_SECT_INIT; - printk (KERN_NOTICE "IFX DEU MD5 initialized%s.\n", disable_deudma ? "" : " (DMA)"); return ret; @@ -308,4 +274,3 @@ void ifxdeu_fini_md5 (void) crypto_unregister_shash(&ifxdeu_md5_alg); } - diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_md5_hmac.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_md5_hmac.c index 6cb2e5a417..109d27cbfb 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_md5_hmac.c +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_md5_hmac.c @@ -63,11 +63,6 @@ #define MD5_HMAC_DBN_TEMP_SIZE 1024 // size in dword, needed for dbn workaround #define HASH_START IFX_HASH_CON -static spinlock_t lock; -#define CRTCL_SECT_INIT spin_lock_init(&lock) -#define CRTCL_SECT_START spin_lock_irqsave(&lock, flag) -#define CRTCL_SECT_END spin_unlock_irqrestore(&lock, flag) - //#define CRYPTO_DEBUG #ifdef CRYPTO_DEBUG extern char debug_level; @@ -84,24 +79,15 @@ struct md5_hmac_ctx { u32 block[MD5_BLOCK_WORDS]; u64 byte_count; u32 dbn; + int started; unsigned int keylen; + struct shash_desc *desc; + u32 (*temp)[MD5_BLOCK_WORDS]; }; -static u32 temp[MD5_HMAC_DBN_TEMP_SIZE]; - extern int disable_deudma; -/*! \fn static u32 endian_swap(u32 input) - * \ingroup IFX_MD5_HMAC_FUNCTIONS - * \brief perform dword level endian swap - * \param input value of dword that requires to be swapped -*/ -static u32 endian_swap(u32 input) -{ - u8 *ptr = (u8 *)&input; - - return ((ptr[3] << 24) | (ptr[2] << 16) | (ptr[1] << 8) | ptr[0]); -} +static int md5_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_final); /*! \fn static void md5_hmac_transform(struct crypto_tfm *tfm, u32 const *in) * \ingroup IFX_MD5_HMAC_FUNCTIONS @@ -113,14 +99,14 @@ static void md5_hmac_transform(struct shash_desc *desc, u32 const *in) { struct md5_hmac_ctx *mctx = crypto_shash_ctx(desc->tfm); - memcpy(&temp[mctx->dbn<<4], in, 64); //dbn workaround - mctx->dbn += 1; - - if ( (mctx->dbn<<4) > MD5_HMAC_DBN_TEMP_SIZE ) + if ( ((mctx->dbn<<4)+1) > MD5_HMAC_DBN_TEMP_SIZE ) { - printk("MD5_HMAC_DBN_TEMP_SIZE exceeded\n"); + //printk("MD5_HMAC_DBN_TEMP_SIZE exceeded\n"); + md5_hmac_final_impl(desc, (u8 *)mctx->hash, false); } + memcpy(&mctx->temp[mctx->dbn], in, 64); //dbn workaround + mctx->dbn += 1; } /*! \fn int md5_hmac_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) @@ -133,41 +119,46 @@ static void md5_hmac_transform(struct shash_desc *desc, u32 const *in) static int md5_hmac_setkey(struct crypto_shash *tfm, const u8 *key, unsigned int keylen) { struct md5_hmac_ctx *mctx = crypto_shash_ctx(tfm); - volatile struct deu_hash_t *hash = (struct deu_hash_t *) HASH_START; + int err; //printk("copying keys to context with length %d\n", keylen); if (keylen > MAX_HASH_KEYLEN) { - printk("Key length more than what DEU hash can handle\n"); - return -EINVAL; - } - + char *hash_alg_name = "md5"; - hash->KIDX |= 0x80000000; // reset all 16 words of the key to '0' - memcpy(&mctx->key, key, keylen); - mctx->keylen = keylen; + mctx->desc->tfm = crypto_alloc_shash(hash_alg_name, 0, 0); + if (IS_ERR(mctx->desc->tfm)) return PTR_ERR(mctx->desc->tfm); + + memset(mctx->key, 0, MAX_HASH_KEYLEN); + err = crypto_shash_digest(mctx->desc, key, keylen, mctx->key); + if (err) return err; + + mctx->keylen = MD5_DIGEST_SIZE; + + crypto_free_shash(mctx->desc->tfm); + } else { + memcpy(mctx->key, key, keylen); + mctx->keylen = keylen; + } + memset(mctx->key + mctx->keylen, 0, MAX_HASH_KEYLEN - mctx->keylen); return 0; - } - /*! \fn int md5_hmac_setkey_hw(const u8 *key, unsigned int keylen) * \ingroup IFX_MD5_HMAC_FUNCTIONS * \brief sets md5 hmac key into the hardware registers * \param key input key * \param keylen key length greater than 64 bytes IS NOT SUPPORTED */ - static int md5_hmac_setkey_hw(const u8 *key, unsigned int keylen) { volatile struct deu_hash_t *hash = (struct deu_hash_t *) HASH_START; - unsigned long flag; int i, j; u32 *in_key = (u32 *)key; //printk("\nsetkey keylen: %d\n key: ", keylen); - CRTCL_SECT_START; + hash->KIDX |= 0x80000000; // reset all 16 words of the key to '0' j = 0; for (i = 0; i < keylen; i+=4) { @@ -177,7 +168,6 @@ static int md5_hmac_setkey_hw(const u8 *key, unsigned int keylen) asm("sync"); j++; } - CRTCL_SECT_END; return 0; } @@ -194,11 +184,11 @@ static int md5_hmac_init(struct shash_desc *desc) mctx->dbn = 0; //dbn workaround - md5_hmac_setkey_hw(mctx->key, mctx->keylen); + mctx->started = 0; + mctx->byte_count = 0; return 0; } -EXPORT_SYMBOL(md5_hmac_init); /*! \fn void md5_hmac_update(struct crypto_tfm *tfm, const u8 *data, unsigned int len) * \ingroup IFX_MD5_HMAC_FUNCTIONS @@ -237,15 +227,26 @@ static int md5_hmac_update(struct shash_desc *desc, const u8 *data, unsigned int memcpy(mctx->block, data, len); return 0; } -EXPORT_SYMBOL(md5_hmac_update); -/*! \fn void md5_hmac_final(struct crypto_tfm *tfm, u8 *out) +/*! \fn static int md5_hmac_final(struct crypto_tfm *tfm, u8 *out) * \ingroup IFX_MD5_HMAC_FUNCTIONS - * \brief compute final md5 hmac value + * \brief call md5_hmac_final_impl with hash_final true * \param tfm linux crypto algo transform * \param out final md5 hmac output value */ static int md5_hmac_final(struct shash_desc *desc, u8 *out) +{ + return md5_hmac_final_impl(desc, out, true); +} + +/*! \fn static int md5_hmac_final_impl(struct crypto_tfm *tfm, u8 *out, bool hash_final) + * \ingroup IFX_MD5_HMAC_FUNCTIONS + * \brief compute final or intermediate md5 hmac value + * \param tfm linux crypto algo transform + * \param out final md5 hmac output value + * \param in finalize or intermediate processing +*/ +static int md5_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_final) { struct md5_hmac_ctx *mctx = crypto_shash_ctx(desc->tfm); const unsigned int offset = mctx->byte_count & 0x3f; @@ -255,27 +256,36 @@ static int md5_hmac_final(struct shash_desc *desc, u8 *out) unsigned long flag; int i = 0; int dbn; - u32 *in = &temp[0]; + u32 *in = mctx->temp[0]; + if (hash_final) { + *p++ = 0x80; + if (padding < 0) { + memset(p, 0x00, padding + sizeof (u64)); + md5_hmac_transform(desc, mctx->block); + p = (char *)mctx->block; + padding = 56; + } + + memset(p, 0, padding); + mctx->block[14] = le32_to_cpu((mctx->byte_count + 64) << 3); // need to add 512 bit of the IPAD operation + mctx->block[15] = 0x00000000; - *p++ = 0x80; - if (padding < 0) { - memset(p, 0x00, padding + sizeof (u64)); md5_hmac_transform(desc, mctx->block); - p = (char *)mctx->block; - padding = 56; } - memset(p, 0, padding); - mctx->block[14] = endian_swap((mctx->byte_count + 64) << 3); // need to add 512 bit of the IPAD operation - mctx->block[15] = 0x00000000; + CRTCL_SECT_HASH_START; - md5_hmac_transform(desc, mctx->block); + MD5_HASH_INIT; - CRTCL_SECT_START; + md5_hmac_setkey_hw(mctx->key, mctx->keylen); //printk("\ndbn = %d\n", mctx->dbn); - hashs->DBN = mctx->dbn; + if (hash_final) { + hashs->DBN = mctx->dbn; + } else { + hashs->DBN = mctx->dbn + 5; + } asm("sync"); *IFX_HASH_CON = 0x0703002D; //khs, go, init, ndc, endi, kyue, hmen, md5 @@ -285,6 +295,15 @@ static int md5_hmac_final(struct shash_desc *desc, u8 *out) // this will not take long } + if (mctx->started) { + hashs->D1R = *((u32 *) mctx->hash + 0); + hashs->D2R = *((u32 *) mctx->hash + 1); + hashs->D3R = *((u32 *) mctx->hash + 2); + hashs->D4R = *((u32 *) mctx->hash + 3); + } else { + mctx->started = 1; + } + for (dbn = 0; dbn < mctx->dbn; dbn++) { for (i = 0; i < 16; i++) { @@ -302,11 +321,12 @@ static int md5_hmac_final(struct shash_desc *desc, u8 *out) in += 16; } - #if 1 - //wait for digest ready - while (! hashs->controlr.DGRY) { - // this will not take long + if (hash_final) { + //wait for digest ready + while (! hashs->controlr.DGRY) { + // this will not take long + } } #endif @@ -314,26 +334,49 @@ static int md5_hmac_final(struct shash_desc *desc, u8 *out) *((u32 *) out + 1) = hashs->D2R; *((u32 *) out + 2) = hashs->D3R; *((u32 *) out + 3) = hashs->D4R; - *((u32 *) out + 4) = hashs->D5R; - /* reset the context after we finish with the hash */ - mctx->byte_count = 0; - memset(&mctx->hash[0], 0, sizeof(MD5_HASH_WORDS)); - memset(&mctx->block[0], 0, sizeof(MD5_BLOCK_WORDS)); - memset(&temp[0], 0, MD5_HMAC_DBN_TEMP_SIZE); + CRTCL_SECT_HASH_END; - CRTCL_SECT_END; - - - return 0; + if (hash_final) { + /* reset the context after we finish with the hash */ + md5_hmac_init(desc); + } else { + mctx->dbn = 0; + } + return 0; } -EXPORT_SYMBOL(md5_hmac_final); +/*! \fn void md5_hmac_init_tfm(struct crypto_tfm *tfm) + * \ingroup IFX_MD5_HMAC_FUNCTIONS + * \brief initialize pointers in md5_hmac_ctx + * \param tfm linux crypto algo transform +*/ +static int md5_hmac_init_tfm(struct crypto_tfm *tfm) +{ + struct md5_hmac_ctx *mctx = crypto_tfm_ctx(tfm); + mctx->temp = kzalloc(4 * MD5_HMAC_DBN_TEMP_SIZE, GFP_KERNEL); + if (IS_ERR(mctx->temp)) return PTR_ERR(mctx->temp); + mctx->desc = kzalloc(sizeof(struct shash_desc), GFP_KERNEL); + if (IS_ERR(mctx->desc)) return PTR_ERR(mctx->desc); + + return 0; +} + +/*! \fn void md5_hmac_exit_tfm(struct crypto_tfm *tfm) + * \ingroup IFX_MD5_HMAC_FUNCTIONS + * \brief free pointers in md5_hmac_ctx + * \param tfm linux crypto algo transform +*/ +static void md5_hmac_exit_tfm(struct crypto_tfm *tfm) +{ + struct md5_hmac_ctx *mctx = crypto_tfm_ctx(tfm); + kfree(mctx->temp); + kfree(mctx->desc); +} /* * \brief MD5_HMAC function mappings */ - static struct shash_alg ifxdeu_md5_hmac_alg = { .digestsize = MD5_DIGEST_SIZE, .init = md5_hmac_init, @@ -345,10 +388,12 @@ static struct shash_alg ifxdeu_md5_hmac_alg = { .cra_name = "hmac(md5)", .cra_driver_name= "ifxdeu-md5_hmac", .cra_priority = 400, - .cra_ctxsize = sizeof(struct md5_hmac_ctx), - .cra_flags = CRYPTO_ALG_TYPE_HASH, + .cra_ctxsize = sizeof(struct md5_hmac_ctx), + .cra_flags = CRYPTO_ALG_TYPE_HASH | CRYPTO_ALG_KERN_DRIVER_ONLY, .cra_blocksize = MD5_HMAC_BLOCK_SIZE, .cra_module = THIS_MODULE, + .cra_init = md5_hmac_init_tfm, + .cra_exit = md5_hmac_exit_tfm, } }; @@ -365,8 +410,6 @@ int ifxdeu_init_md5_hmac (void) if ((ret = crypto_register_shash(&ifxdeu_md5_hmac_alg))) goto md5_hmac_err; - CRTCL_SECT_INIT; - printk (KERN_NOTICE "IFX DEU MD5_HMAC initialized%s.\n", disable_deudma ? "" : " (DMA)"); return ret; @@ -383,5 +426,3 @@ void ifxdeu_fini_md5_hmac (void) { crypto_unregister_shash(&ifxdeu_md5_hmac_alg); } - - diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c index d711c4804d..a20430c448 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c @@ -38,14 +38,13 @@ \brief ifx deu sha1 functions */ - /* Project header */ #include #include #include #include -#include #include +#include #include #include #include @@ -65,11 +64,6 @@ #define SHA1_HMAC_BLOCK_SIZE 64 #define HASH_START IFX_HASH_CON -static spinlock_t lock; -#define CRTCL_SECT_INIT spin_lock_init(&lock) -#define CRTCL_SECT_START spin_lock_irqsave(&lock, flag) -#define CRTCL_SECT_END spin_unlock_irqrestore(&lock, flag) - //#define CRYPTO_DEBUG #ifdef CRYPTO_DEBUG extern char debug_level; @@ -91,20 +85,21 @@ struct sha1_ctx { extern int disable_deudma; - -/*! \fn static void sha1_transform (u32 *state, const u32 *in) +/*! \fn static void sha1_transform1 (u32 *state, const u32 *in) * \ingroup IFX_SHA1_FUNCTIONS * \brief main interface to sha1 hardware * \param state current state * \param in 64-byte block of input */ -static void sha1_transform (struct sha1_ctx *sctx, u32 *state, const u32 *in) +static void sha1_transform1 (struct sha1_ctx *sctx, u32 *state, const u32 *in) { int i = 0; volatile struct deu_hash_t *hashs = (struct deu_hash_t *) HASH_START; unsigned long flag; - CRTCL_SECT_START; + CRTCL_SECT_HASH_START; + + SHA_HASH_INIT; /* For context switching purposes, the previous hash output * is loaded back into the output register @@ -137,20 +132,18 @@ static void sha1_transform (struct sha1_ctx *sctx, u32 *state, const u32 *in) sctx->started = 1; - CRTCL_SECT_END; + CRTCL_SECT_HASH_END; } -/*! \fn static void sha1_init(struct crypto_tfm *tfm) +/*! \fn static void sha1_init1(struct crypto_tfm *tfm) * \ingroup IFX_SHA1_FUNCTIONS * \brief initialize sha1 hardware * \param tfm linux crypto algo transform */ -static int sha1_init(struct shash_desc *desc) +static int sha1_init1(struct shash_desc *desc) { struct sha1_ctx *sctx = shash_desc_ctx(desc); - SHA_HASH_INIT; - sctx->started = 0; sctx->count = 0; return 0; @@ -174,9 +167,9 @@ static int sha1_update(struct shash_desc * desc, const u8 *data, if ((j + len) > 63) { memcpy (&sctx->buffer[j], data, (i = 64 - j)); - sha1_transform (sctx, sctx->state, (const u32 *)sctx->buffer); + sha1_transform1 (sctx, sctx->state, (const u32 *)sctx->buffer); for (; i + 63 < len; i += 64) { - sha1_transform (sctx, sctx->state, (const u32 *)&data[i]); + sha1_transform1 (sctx, sctx->state, (const u32 *)&data[i]); } j = 0; @@ -229,15 +222,7 @@ static int sha1_final(struct shash_desc *desc, u8 *out) /* Append length */ sha1_update (desc, bits, sizeof bits); - CRTCL_SECT_START; - - *((u32 *) out + 0) = hashs->D1R; - *((u32 *) out + 1) = hashs->D2R; - *((u32 *) out + 2) = hashs->D3R; - *((u32 *) out + 3) = hashs->D4R; - *((u32 *) out + 4) = hashs->D5R; - - CRTCL_SECT_END; + memcpy(out, sctx->hash, SHA1_DIGEST_SIZE); // Wipe context memset (sctx, 0, sizeof *sctx); @@ -250,7 +235,7 @@ static int sha1_final(struct shash_desc *desc, u8 *out) */ static struct shash_alg ifxdeu_sha1_alg = { .digestsize = SHA1_DIGEST_SIZE, - .init = sha1_init, + .init = sha1_init1, .update = sha1_update, .final = sha1_final, .descsize = sizeof(struct sha1_ctx), @@ -259,7 +244,7 @@ static struct shash_alg ifxdeu_sha1_alg = { .cra_name = "sha1", .cra_driver_name= "ifxdeu-sha1", .cra_priority = 300, - .cra_flags = CRYPTO_ALG_TYPE_HASH, + .cra_flags = CRYPTO_ALG_TYPE_HASH | CRYPTO_ALG_KERN_DRIVER_ONLY, .cra_blocksize = SHA1_HMAC_BLOCK_SIZE, .cra_module = THIS_MODULE, } @@ -278,8 +263,6 @@ int ifxdeu_init_sha1 (void) if ((ret = crypto_register_shash(&ifxdeu_sha1_alg))) goto sha1_err; - CRTCL_SECT_INIT; - printk (KERN_NOTICE "IFX DEU SHA1 initialized%s.\n", disable_deudma ? "" : " (DMA)"); return ret; @@ -298,5 +281,3 @@ void ifxdeu_fini_sha1 (void) } - - diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c index 7776c51686..69504efe93 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c @@ -38,14 +38,13 @@ \brief ifx sha1 hmac functions */ - /* Project header */ #include #include #include #include -#include #include +#include #include #include #include @@ -60,17 +59,14 @@ #endif #define SHA1_DIGEST_SIZE 20 +#define SHA1_BLOCK_WORDS 16 +#define SHA1_HASH_WORDS 5 #define SHA1_HMAC_BLOCK_SIZE 64 #define SHA1_HMAC_DBN_TEMP_SIZE 1024 // size in dword, needed for dbn workaround #define HASH_START IFX_HASH_CON #define SHA1_HMAC_MAX_KEYLEN 64 -static spinlock_t lock; -#define CRTCL_SECT_INIT spin_lock_init(&lock) -#define CRTCL_SECT_START spin_lock_irqsave(&lock, flag) -#define CRTCL_SECT_END spin_unlock_irqrestore(&lock, flag) - #ifdef CRYPTO_DEBUG extern char debug_level; #define DPRINTF(level, format, args...) if (level < debug_level) printk(KERN_INFO "[%s %s %d]: " format, __FILE__, __func__, __LINE__, ##args); @@ -83,16 +79,19 @@ struct sha1_hmac_ctx { u8 buffer[SHA1_HMAC_BLOCK_SIZE]; u8 key[SHA1_HMAC_MAX_KEYLEN]; - u32 state[5]; + u32 hash[SHA1_HASH_WORDS]; u32 dbn; + int started; u64 count; + struct shash_desc *desc; + u32 (*temp)[SHA1_BLOCK_WORDS]; }; -static u32 temp[SHA1_HMAC_DBN_TEMP_SIZE]; - extern int disable_deudma; +static int sha1_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_final); + /*! \fn static void sha1_hmac_transform(struct crypto_tfm *tfm, u32 const *in) * \ingroup IFX_SHA1_HMAC_FUNCTIONS * \brief save input block to context @@ -103,14 +102,15 @@ static int sha1_hmac_transform(struct shash_desc *desc, u32 const *in) { struct sha1_hmac_ctx *sctx = crypto_shash_ctx(desc->tfm); - memcpy(&temp[sctx->dbn<<4], in, 64); //dbn workaround - sctx->dbn += 1; - - if ( (sctx->dbn<<4) > SHA1_HMAC_DBN_TEMP_SIZE ) + if ( ((sctx->dbn<<4)+1) > SHA1_HMAC_DBN_TEMP_SIZE ) { - printk("SHA1_HMAC_DBN_TEMP_SIZE exceeded\n"); + //printk("SHA1_HMAC_DBN_TEMP_SIZE exceeded\n"); + sha1_hmac_final_impl(desc, (u8 *)sctx->hash, false); } - + + memcpy(&sctx->temp[sctx->dbn], in, 64); //dbn workaround + sctx->dbn += 1; + return 0; } @@ -124,24 +124,32 @@ static int sha1_hmac_transform(struct shash_desc *desc, u32 const *in) static int sha1_hmac_setkey(struct crypto_shash *tfm, const u8 *key, unsigned int keylen) { struct sha1_hmac_ctx *sctx = crypto_shash_ctx(tfm); - volatile struct deu_hash_t *hashs = (struct deu_hash_t *) HASH_START; - + int err; + if (keylen > SHA1_HMAC_MAX_KEYLEN) { - printk("Key length exceeds maximum key length\n"); - return -EINVAL; + char *hash_alg_name = "sha1"; + + sctx->desc->tfm = crypto_alloc_shash(hash_alg_name, 0, 0); + if (IS_ERR(sctx->desc->tfm)) return PTR_ERR(sctx->desc->tfm); + + memset(sctx->key, 0, SHA1_HMAC_MAX_KEYLEN); + err = crypto_shash_digest(sctx->desc, key, keylen, sctx->key); + if (err) return err; + + sctx->keylen = SHA1_DIGEST_SIZE; + + crypto_free_shash(sctx->desc->tfm); + } else { + memcpy(sctx->key, key, keylen); + sctx->keylen = keylen; } + memset(sctx->key + sctx->keylen, 0, SHA1_HMAC_MAX_KEYLEN - sctx->keylen); //printk("Setting keys of len: %d\n", keylen); - - hashs->KIDX |= 0x80000000; //reset keys back to 0 - memcpy(&sctx->key, key, keylen); - sctx->keylen = keylen; return 0; - } - /*! \fn int sha1_hmac_setkey_hw(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) * \ingroup IFX_SHA1_HMAC_FUNCTIONS * \brief sets sha1 hmac key into hw registers @@ -153,12 +161,11 @@ static int sha1_hmac_setkey_hw(const u8 *key, unsigned int keylen) { volatile struct deu_hash_t *hash = (struct deu_hash_t *) HASH_START; int i, j; - unsigned long flag; u32 *in_key = (u32 *)key; j = 0; - CRTCL_SECT_START; + hash->KIDX |= 0x80000000; //reset keys back to 0 for (i = 0; i < keylen; i+=4) { hash->KIDX = j; @@ -167,7 +174,6 @@ static int sha1_hmac_setkey_hw(const u8 *key, unsigned int keylen) j++; } - CRTCL_SECT_END; return 0; } @@ -182,7 +188,8 @@ static int sha1_hmac_init(struct shash_desc *desc) //printk("debug ln: %d, fn: %s\n", __LINE__, __func__); sctx->dbn = 0; //dbn workaround - sha1_hmac_setkey_hw(sctx->key, sctx->keylen); + sctx->started = 0; + sctx->count = 0; return 0; } @@ -220,15 +227,26 @@ static int sha1_hmac_update(struct shash_desc *desc, const u8 *data, return 0; } -/*! \fn static void sha1_hmac_final(struct crypto_tfm *tfm, u8 *out) +/*! \fn static int sha1_hmac_final(struct crypto_tfm *tfm, u8 *out) * \ingroup IFX_SHA1_HMAC_FUNCTIONS - * \brief ompute final sha1 hmac value + * \brief call sha1_hmac_final_impl with hash_final true * \param tfm linux crypto algo transform * \param out final sha1 hmac output value */ static int sha1_hmac_final(struct shash_desc *desc, u8 *out) { - //struct sha1_hmac_ctx *sctx = shash_desc_ctx(desc); + return sha1_hmac_final_impl(desc, out, true); +} + +/*! \fn static int sha1_hmac_final_impl(struct crypto_tfm *tfm, u8 *out, bool hash_final) + * \ingroup IFX_SHA1_HMAC_FUNCTIONS + * \brief ompute final or intermediate sha1 hmac value + * \param tfm linux crypto algo transform + * \param out final sha1 hmac output value + * \param in finalize or intermediate processing +*/ +static int sha1_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_final) +{ struct sha1_hmac_ctx *sctx = crypto_shash_ctx(desc->tfm); u32 index, padlen; u64 t; @@ -238,37 +256,48 @@ static int sha1_hmac_final(struct shash_desc *desc, u8 *out) unsigned long flag; int i = 0; int dbn; - u32 *in = &temp[0]; - - t = sctx->count + 512; // need to add 512 bit of the IPAD operation - bits[7] = 0xff & t; - t >>= 8; - bits[6] = 0xff & t; - t >>= 8; - bits[5] = 0xff & t; - t >>= 8; - bits[4] = 0xff & t; - t >>= 8; - bits[3] = 0xff & t; - t >>= 8; - bits[2] = 0xff & t; - t >>= 8; - bits[1] = 0xff & t; - t >>= 8; - bits[0] = 0xff & t; + u32 *in = sctx->temp[0]; - /* Pad out to 56 mod 64 */ - index = (sctx->count >> 3) & 0x3f; - padlen = (index < 56) ? (56 - index) : ((64 + 56) - index); - sha1_hmac_update (desc, padding, padlen); + if (hash_final) { + t = sctx->count + 512; // need to add 512 bit of the IPAD operation + bits[7] = 0xff & t; + t >>= 8; + bits[6] = 0xff & t; + t >>= 8; + bits[5] = 0xff & t; + t >>= 8; + bits[4] = 0xff & t; + t >>= 8; + bits[3] = 0xff & t; + t >>= 8; + bits[2] = 0xff & t; + t >>= 8; + bits[1] = 0xff & t; + t >>= 8; + bits[0] = 0xff & t; - /* Append length */ - sha1_hmac_update (desc, bits, sizeof bits); + /* Pad out to 56 mod 64 */ + index = (sctx->count >> 3) & 0x3f; + padlen = (index < 56) ? (56 - index) : ((64 + 56) - index); + sha1_hmac_update (desc, padding, padlen); + + /* Append length */ + sha1_hmac_update (desc, bits, sizeof bits); + } + + CRTCL_SECT_HASH_START; + + SHA_HASH_INIT; + + sha1_hmac_setkey_hw(sctx->key, sctx->keylen); + + if (hash_final) { + hashs->DBN = sctx->dbn; + } else { + hashs->DBN = sctx->dbn + 5; + } + asm("sync"); - CRTCL_SECT_START; - - hashs->DBN = sctx->dbn; - //for vr9 change, ENDI = 1 *IFX_HASH_CON = HASH_CON_VALUE; @@ -277,28 +306,40 @@ static int sha1_hmac_final(struct shash_desc *desc, u8 *out) // this will not take long } + if (sctx->started) { + hashs->D1R = *((u32 *) sctx->hash + 0); + hashs->D2R = *((u32 *) sctx->hash + 1); + hashs->D3R = *((u32 *) sctx->hash + 2); + hashs->D4R = *((u32 *) sctx->hash + 3); + hashs->D5R = *((u32 *) sctx->hash + 4); + } else { + sctx->started = 1; + } + for (dbn = 0; dbn < sctx->dbn; dbn++) { - for (i = 0; i < 16; i++) { - hashs->MR = in[i]; - }; + for (i = 0; i < 16; i++) { + hashs->MR = in[i]; + }; - hashs->controlr.GO = 1; - asm("sync"); + hashs->controlr.GO = 1; + asm("sync"); - //wait for processing - while (hashs->controlr.BSY) { + //wait for processing + while (hashs->controlr.BSY) { // this will not take long - } + } - in += 16; -} + in += 16; + } #if 1 - //wait for digest ready - while (! hashs->controlr.DGRY) { - // this will not take long + if (hash_final) { + //wait for digest ready + while (! hashs->controlr.DGRY) { + // this will not take long + } } #endif @@ -308,40 +349,71 @@ static int sha1_hmac_final(struct shash_desc *desc, u8 *out) *((u32 *) out + 3) = hashs->D4R; *((u32 *) out + 4) = hashs->D5R; - memset(&sctx->buffer[0], 0, SHA1_HMAC_BLOCK_SIZE); - sctx->count = 0; - - //printk("debug ln: %d, fn: %s\n", __LINE__, __func__); - CRTCL_SECT_END; + CRTCL_SECT_HASH_END; + if (hash_final) { + sha1_hmac_init(desc); + } else { + sctx->dbn = 0; + } + //printk("debug ln: %d, fn: %s\n", __LINE__, __func__); return 0; } -/* - * \brief SHA1-HMAC function mappings +/*! \fn void sha1_hmac_init_tfm(struct crypto_tfm *tfm) + * \ingroup IFX_SHA1_HMAC_FUNCTIONS + * \brief initialize pointers in sha1_hmac_ctx + * \param tfm linux crypto algo transform */ +static int sha1_hmac_init_tfm(struct crypto_tfm *tfm) +{ + struct sha1_hmac_ctx *sctx = crypto_tfm_ctx(tfm); + sctx->temp = kzalloc(4 * SHA1_HMAC_DBN_TEMP_SIZE, GFP_KERNEL); + if (IS_ERR(sctx->temp)) return PTR_ERR(sctx->temp); + sctx->desc = kzalloc(sizeof(struct shash_desc), GFP_KERNEL); + if (IS_ERR(sctx->desc)) return PTR_ERR(sctx->desc); + + return 0; +} + +/*! \fn void sha1_hmac_exit_tfm(struct crypto_tfm *tfm) + * \ingroup IFX_SHA1_HMAC_FUNCTIONS + * \brief free pointers in sha1_hmac_ctx + * \param tfm linux crypto algo transform +*/ +static void sha1_hmac_exit_tfm(struct crypto_tfm *tfm) +{ + struct sha1_hmac_ctx *sctx = crypto_tfm_ctx(tfm); + kfree(sctx->temp); + kfree(sctx->desc); +} + +/* + * \brief SHA1_HMAC function mappings +*/ + static struct shash_alg ifxdeu_sha1_hmac_alg = { - .digestsize = SHA1_DIGEST_SIZE, - .init = sha1_hmac_init, - .update = sha1_hmac_update, - .final = sha1_hmac_final, - .setkey = sha1_hmac_setkey, - .descsize = sizeof(struct sha1_hmac_ctx), - .base = { - .cra_name = "hmac(sha1)", - .cra_driver_name= "ifxdeu-sha1_hmac", - .cra_priority = 400, - .cra_ctxsize = sizeof(struct sha1_hmac_ctx), - .cra_flags = CRYPTO_ALG_TYPE_HASH, - .cra_blocksize = SHA1_HMAC_BLOCK_SIZE, - .cra_module = THIS_MODULE, + .digestsize = SHA1_DIGEST_SIZE, + .init = sha1_hmac_init, + .update = sha1_hmac_update, + .final = sha1_hmac_final, + .setkey = sha1_hmac_setkey, + .descsize = sizeof(struct sha1_hmac_ctx), + .base = { + .cra_name = "hmac(sha1)", + .cra_driver_name= "ifxdeu-sha1_hmac", + .cra_priority = 400, + .cra_ctxsize = sizeof(struct sha1_hmac_ctx), + .cra_flags = CRYPTO_ALG_TYPE_HASH | CRYPTO_ALG_KERN_DRIVER_ONLY, + .cra_blocksize = SHA1_HMAC_BLOCK_SIZE, + .cra_module = THIS_MODULE, + .cra_init = sha1_hmac_init_tfm, + .cra_exit = sha1_hmac_exit_tfm, } - }; - /*! \fn int ifxdeu_init_sha1_hmac (void) * \ingroup IFX_SHA1_HMAC_FUNCTIONS * \brief initialize sha1 hmac driver @@ -355,8 +427,6 @@ int ifxdeu_init_sha1_hmac (void) if ((ret = crypto_register_shash(&ifxdeu_sha1_hmac_alg))) goto sha1_err; - CRTCL_SECT_INIT; - printk (KERN_NOTICE "IFX DEU SHA1_HMAC initialized%s.\n", disable_deudma ? "" : " (DMA)"); return ret; @@ -376,4 +446,3 @@ void ifxdeu_fini_sha1_hmac (void) } - diff --git a/package/kernel/lantiq/ltq-ifxos/Makefile b/package/kernel/lantiq/ltq-ifxos/Makefile index e98cb21eff..bc586faaf1 100644 --- a/package/kernel/lantiq/ltq-ifxos/Makefile +++ b/package/kernel/lantiq/ltq-ifxos/Makefile @@ -6,13 +6,17 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk -PKG_NAME:=lib_ifxos -PKG_VERSION:=1.5.19 -PKG_RELEASE:=4 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_URL:=https://github.com/xdarklight/$(PKG_NAME)/archive/v$(PKG_VERSION) -PKG_HASH:=ed7fe39311d7a4a13d23ed0ae2445c0d825b472b5a98da9b72bcaabcf5ed2d5f +PKG_NAME:=ifxos +PKG_VERSION:=1.7.1 +PKG_RELEASE:=$(AUTORELEASE) + +UGW_VERSION=8.5.2.10 +UGW_BASENAME=$(PKG_NAME)-ugw_$(UGW_VERSION) + +PKG_SOURCE:=$(UGW_BASENAME).tar.bz2 +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(UGW_BASENAME) +PKG_SOURCE_URL:=https://gitlab.com/prpl-foundation/intel/$(PKG_NAME)/-/archive/ugw_$(UGW_VERSION)/ +PKG_HASH:=055a1f5eab0abfaac34ac7b1613b93ec341fe9ae8462cb11c36c2b0989ce0ca7 PKG_MAINTAINER:=John Crispin PKG_LICENSE:=GPL-2.0 BSD-2-Clause PKG_LICENSE_FILES:=LICENSE @@ -45,7 +49,7 @@ ifdef CONFIG_TARGET_lantiq $(INSTALL_DIR) $(1)/usr/{lib,include/ifxos} $(CP) $(PKG_BUILD_DIR)/src/include/* $(1)/usr/include/ifxos mkdir -p $(1)/usr/lib - $(CP) $(PKG_BUILD_DIR)/src/libifxos.a $(1)/usr/lib/libifxos.a + $(CP) $(PKG_BUILD_DIR)/src/.libs/libifxos.a $(1)/usr/lib/libifxos.a endef endif diff --git a/package/kernel/lantiq/ltq-ifxos/patches/001-warnings.patch b/package/kernel/lantiq/ltq-ifxos/patches/001-warnings.patch index 78940649c5..2c04f9b009 100644 --- a/package/kernel/lantiq/ltq-ifxos/patches/001-warnings.patch +++ b/package/kernel/lantiq/ltq-ifxos/patches/001-warnings.patch @@ -1,24 +1,10 @@ ---- a/src/include/linux/ifxos_linux_thread.h -+++ b/src/include/linux/ifxos_linux_thread.h -@@ -206,7 +206,7 @@ typedef struct - /** - LINUX User Thread - map the Thread ID. - */ --typedef int IFXOS_thread_t; -+typedef pthread_t IFXOS_thread_t; +--- a/src/include/linux/ifxos_linux_common.h ++++ b/src/include/linux/ifxos_linux_common.h +@@ -49,6 +49,7 @@ + IFX Linux adaptation - Includes (Linux Kernel) + ========================================================================= */ + #include ++#include + #include - /** - LINUX Kernel Process - map the Process ID. ---- a/src/linux/ifxos_linux_socket_appl.c -+++ b/src/linux/ifxos_linux_socket_appl.c -@@ -363,8 +363,8 @@ IFX_int_t IFXOS_SocketSendTo( - IFXOS_RETURN_IF_POINTER_NULL(pBuffer, IFX_ERROR); - IFXOS_RETURN_IF_ARG_LE_ZERO(bufSize_byte, IFX_ERROR); - -- ret = (IFX_int_t)sendto((int)socFd, (const char*)pBuffer, -- (int)bufSize_byte, 0, pSocAddr, sizeof(IFXOS_sockAddr_t)); -+ ret = (IFX_int_t)sendto(socFd, pBuffer, -+ bufSize_byte, 0, (struct sockaddr *)pSocAddr, sizeof(IFXOS_sockAddr_t)); - - return ret; - } + /* ============================================================================ diff --git a/package/kernel/lantiq/ltq-ifxos/patches/002-fix-compile.patch b/package/kernel/lantiq/ltq-ifxos/patches/002-fix-compile.patch index 38722290de..7d78c12685 100644 --- a/package/kernel/lantiq/ltq-ifxos/patches/002-fix-compile.patch +++ b/package/kernel/lantiq/ltq-ifxos/patches/002-fix-compile.patch @@ -1,18 +1,18 @@ ---- a/src/linux/ifxos_linux_copy_user_space_drv.c -+++ b/src/linux/ifxos_linux_copy_user_space_drv.c -@@ -29,7 +29,7 @@ - #ifdef MODULE - #include - #endif +--- a/src/linux/ifxos_linux_socket_drv.c ++++ b/src/linux/ifxos_linux_socket_drv.c +@@ -28,7 +28,7 @@ + #include + #include + #include -#include +#include #include "ifx_types.h" #include "ifxos_rt_if_check.h" ---- a/src/linux/ifxos_linux_socket_drv.c -+++ b/src/linux/ifxos_linux_socket_drv.c +--- a/src/linux/ifxos_linux_socket_ipv6_drv.c ++++ b/src/linux/ifxos_linux_socket_ipv6_drv.c @@ -25,7 +25,7 @@ - #endif + #include #include #include -#include diff --git a/package/kernel/lantiq/ltq-ifxos/patches/020-no-O3.patch b/package/kernel/lantiq/ltq-ifxos/patches/020-no-O3.patch index d2e816f5c0..e883b5b1fd 100644 --- a/package/kernel/lantiq/ltq-ifxos/patches/020-no-O3.patch +++ b/package/kernel/lantiq/ltq-ifxos/patches/020-no-O3.patch @@ -1,6 +1,6 @@ --- a/src/Makefile.am +++ b/src/Makefile.am -@@ -45,8 +45,6 @@ endif !HAVE_GCC +@@ -48,8 +48,6 @@ endif !HAVE_GCC if ENABLE_DEBUG used_gcc_cflags += -O1 -g diff --git a/package/kernel/lantiq/ltq-ifxos/patches/100-compat.patch b/package/kernel/lantiq/ltq-ifxos/patches/100-compat.patch index d9bbf8d7cc..0fc2c2c5e6 100644 --- a/package/kernel/lantiq/ltq-ifxos/patches/100-compat.patch +++ b/package/kernel/lantiq/ltq-ifxos/patches/100-compat.patch @@ -1,119 +1,3 @@ ---- a/src/linux/ifxos_linux_thread_drv.c -+++ b/src/linux/ifxos_linux_thread_drv.c -@@ -38,6 +38,7 @@ - #include - #endif - #include -+#include - - - #include "ifx_types.h" -@@ -70,10 +71,6 @@ - #if ( defined(IFXOS_HAVE_THREAD) && (IFXOS_HAVE_THREAD == 1) ) - - --IFXOS_STATIC IFX_int32_t IFXOS_KernelThreadStartup( -- IFXOS_ThreadCtrl_t *pThrCntrl); -- -- - /* ============================================================================ - IFX Linux adaptation - Kernel Thread handling - ========================================================================= */ -@@ -98,9 +95,9 @@ IFXOS_STATIC IFX_int32_t IFXOS_KernelThr - - IFX_SUCCESS on success - - IFX_ERROR on error - */ --IFXOS_STATIC IFX_int32_t IFXOS_KernelThreadStartup( -- IFXOS_ThreadCtrl_t *pThrCntrl) -+int IFXOS_KernelThreadStartup(void *data) - { -+ IFXOS_ThreadCtrl_t *pThrCntrl = (IFXOS_ThreadCtrl_t*) data; - IFX_int32_t retVal = IFX_ERROR; - #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) - struct task_struct *kthread = current; -@@ -141,7 +138,7 @@ IFXOS_STATIC IFX_int32_t IFXOS_KernelThr - /* let others run */ - unlock_kernel(); - #else -- daemonize(pThrCntrl->thrParams.pName); -+ //daemonize(pThrCntrl->thrParams.pName); - - /* Enable signals in Kernel >= 2.6 */ - allow_signal(SIGKILL); -@@ -221,9 +218,11 @@ IFX_int32_t IFXOS_ThreadInit( - init_completion(&pThrCntrl->thrCompletion); - - /* start kernel thread via the wrapper function */ -- pThrCntrl->tid = kernel_thread( (IFXOS_KERNEL_THREAD_StartRoutine)IFXOS_KernelThreadStartup, -- (void *)pThrCntrl, -- IFXOS_DRV_THREAD_OPTIONS); -+ pThrCntrl->tid = kthread_run(IFXOS_KernelThreadStartup, (void *)pThrCntrl, pThrCntrl->thrParams.pName); -+ if (IS_ERR(pThrCntrl->tid)) { -+ IFXOS_PRN_USR_ERR_NL( IFXOS, IFXOS_PRN_LEVEL_ERR, -+ ("IFXOS ERROR - Problem creating thread: %li" IFXOS_CRLF, PTR_ERR(pThrCntrl->tid))); -+ } - - pThrCntrl->bValid = IFX_TRUE; - ---- a/src/include/linux/ifxos_linux_thread.h -+++ b/src/include/linux/ifxos_linux_thread.h -@@ -152,7 +152,7 @@ typedef struct - IFXOS_ThreadFunction_t pThrFct; - - /** Kernel thread process ID */ -- IFX_int32_t tid; -+ struct task_struct *tid; - - /** requested kernel thread priority */ - IFX_int32_t nPriority; ---- a/src/linux/ifxos_linux_socket_drv.c -+++ b/src/linux/ifxos_linux_socket_drv.c -@@ -19,6 +19,7 @@ - /* ============================================================================ - IFX Linux adaptation - Global Includes - Kernel - ========================================================================= */ -+#include - #include - #ifdef MODULE - #include -@@ -166,23 +167,33 @@ IFX_int_t IFXOS_SocketSendTo( - IFXOS_RETURN_IF_POINTER_NULL(pBuffer, IFX_ERROR); - IFXOS_RETURN_IF_ARG_LE_ZERO(bufSize_byte, IFX_ERROR); - -+ iov.iov_base = pBuffer; -+ iov.iov_len = (unsigned int) bufSize_byte; -+ - msg.msg_name = (void *) pSocAddr; - msg.msg_namelen = sizeof(IFXOS_sockAddr_t); -- msg.msg_iov = &iov; -- msg.msg_iovlen = 1; - msg.msg_control = IFX_NULL; - msg.msg_controllen = 0; - msg.msg_flags = MSG_DONTWAIT; - -- msg.msg_iov->iov_base = pBuffer; -- msg.msg_iov->iov_len = (unsigned int) bufSize_byte; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) -+ msg.msg_iov = &iov; -+ msg.msg_iovlen = 1; -+#else -+ iov_iter_init(&msg.msg_iter, WRITE, &iov, 1, bufSize_byte); -+#endif - - /* Modify address limitation which is used if user space is calling - kernel space, otherwise sock_sendmsg() will fail.*/ - old_fs = get_fs(); - set_fs(KERNEL_DS); - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) - ret = sock_sendmsg((struct socket *) socFd, &msg, bufSize_byte); -+#else -+ ret = sock_sendmsg((struct socket *) socFd, &msg); -+#endif -+ - set_fs(old_fs); - - return ret; --- a/src/linux/ifxos_linux_memory_map_drv.c +++ b/src/linux/ifxos_linux_memory_map_drv.c @@ -25,6 +25,7 @@ @@ -124,28 +8,8 @@ #include #ifdef MODULE #include -@@ -87,6 +88,7 @@ IFX_int32_t IFXOS_Phy2VirtMap( - IFXOS_RETURN_IF_POINTER_NOT_NULL(*ppVirtAddr, IFX_ERROR); - IFXOS_RETURN_IF_ARG_LE_ZERO(addrRangeSize_byte, IFX_ERROR); - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) - if ( check_mem_region(physicalAddr, addrRangeSize_byte) ) - { - IFXOS_PRN_USR_ERR_NL( IFXOS, IFXOS_PRN_LEVEL_ERR, -@@ -98,10 +100,25 @@ IFX_int32_t IFXOS_Phy2VirtMap( - - /* can't fail */ - request_mem_region(physicalAddr, addrRangeSize_byte, pName); -+#else -+ if ( !request_mem_region(physicalAddr, addrRangeSize_byte, pName) ) -+ { -+ IFXOS_PRN_USR_ERR_NL( IFXOS, IFXOS_PRN_LEVEL_ERR, -+ ("IFXOS: ERROR Phy2Virt map, region request - addr 0x%08lX (size 0x%lX) not free" IFXOS_CRLF, -+ physicalAddr, addrRangeSize_byte)); -+ -+ return IFX_ERROR; -+ } -+#endif +@@ -97,8 +98,13 @@ IFX_int32_t IFXOS_Phy2VirtMap( + } /* remap memory (not cache able): physical --> virtual */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) @@ -157,4 +21,4 @@ + if (pVirtAddr == IFX_NULL) { - IFXOS_PRN_USR_ERR_NL( IFXOS, IFXOS_PRN_LEVEL_ERR, + IFXOS_PRN_USR_ERR_NL( IFXOS, IFXOS_PRN_LEVEL_ERR, diff --git a/package/kernel/lantiq/ltq-ifxos/patches/200-Fix-app-compilation-failure-from-inclusion-of-wrong-.patch b/package/kernel/lantiq/ltq-ifxos/patches/200-Fix-app-compilation-failure-from-inclusion-of-wrong-.patch deleted file mode 100644 index 453d85849b..0000000000 --- a/package/kernel/lantiq/ltq-ifxos/patches/200-Fix-app-compilation-failure-from-inclusion-of-wrong-.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 7d52945b0b261c54ec736ecc435936c5fb8b81a4 Mon Sep 17 00:00:00 2001 -From: Yousong Zhou -Date: Thu, 30 Nov 2017 11:07:12 +0800 -Subject: [PATCH] Fix app compilation failure from inclusion of wrong headers - -Compiling against glibc can fail with the following errors - - In file included from /home/stefan/Router/o26431-vmmc_v5/source/staging_dir/toolchain-mips_24kc_gcc-5.5.0_glibc/include/bits/fcntl-linux.h:321:0, - from /home/stefan/Router/o26431-vmmc_v5/source/staging_dir/toolchain-mips_24kc_gcc-5.5.0_glibc/include/bits/fcntl.h:104, - from /home/stefan/Router/o26431-vmmc_v5/source/staging_dir/toolchain-mips_24kc_gcc-5.5.0_glibc/include/fcntl.h:35, - from linux/ifxos_linux_device_access_appl.c:30: - /home/stefan/Router/o26431-vmmc_v5/source/build_dir/target-mips_24kc_glibc/linux-lantiq_xrx200/linux-4.9.65/include/linux/falloc.h:12:2: error: unknown type name '__s16' - __s16 l_type; - ^ - /home/stefan/Router/o26431-vmmc_v5/source/build_dir/target-mips_24kc_glibc/linux-lantiq_xrx200/linux-4.9.65/include/linux/falloc.h:13:2: error: unknown type name '__s16' - __s16 l_whence; - ^ - /home/stefan/Router/o26431-vmmc_v5/source/build_dir/target-mips_24kc_glibc/linux-lantiq_xrx200/linux-4.9.65/include/linux/falloc.h:14:2: error: unknown type name '__s64' - __s64 l_start; - ^ - /home/stefan/Router/o26431-vmmc_v5/source/build_dir/target-mips_24kc_glibc/linux-lantiq_xrx200/linux-4.9.65/include/linux/falloc.h:15:2: error: unknown type name '__s64' - __s64 l_len; /* len == 0 means until end of file */ - ^ - /home/stefan/Router/o26431-vmmc_v5/source/build_dir/target-mips_24kc_glibc/linux-lantiq_xrx200/linux-4.9.65/include/linux/falloc.h:16:2: error: unknown type name '__s32' - __s32 l_sysid; - ^ - /home/stefan/Router/o26431-vmmc_v5/source/build_dir/target-mips_24kc_glibc/linux-lantiq_xrx200/linux-4.9.65/include/linux/falloc.h:17:2: error: unknown type name '__u32' - __u32 l_pid; - ^ - /home/stefan/Router/o26431-vmmc_v5/source/build_dir/target-mips_24kc_glibc/linux-lantiq_xrx200/linux-4.9.65/include/linux/falloc.h:18:2: error: unknown type name '__s32' - __s32 l_pad[4]; /* reserved area */ - ^ - Makefile:1945: recipe for target 'libifxos_a-ifxos_linux_device_access_appl.o' failed - -Ref: https://bugs.openwrt.org/index.php?do=details&task_id=1196 ---- - src/Makefile.am | 6 +----- - 1 file changed, 1 insertion(+), 5 deletions(-) - ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -14,11 +14,7 @@ lib_LIBRARIES = libifxos.a - - AM_CPPFLAGS = \ - -I@srcdir@\ -- -I@srcdir@/include \ -- -I@KERNEL_INCL_PATH@ \ -- -I@KERNEL_BUILD_PATH@/include \ -- -I@KERNEL_BUILD_PATH@/include2 \ -- -I$(TARGET_INCL_PATH) -+ -I@srcdir@/include - - if HAVE_GCC - diff --git a/package/kernel/lantiq/ltq-vdsl/patches/100-compat.patch b/package/kernel/lantiq/ltq-vdsl/patches/100-compat.patch index edacd5f6b8..7670fe6a00 100644 --- a/package/kernel/lantiq/ltq-vdsl/patches/100-compat.patch +++ b/package/kernel/lantiq/ltq-vdsl/patches/100-compat.patch @@ -82,9 +82,9 @@ DSL_DRV_DevNodeInit(); -+ dsl_class = class_create(THIS_MODULE, "dsl_cpe_api0"); ++ dsl_class = class_create(THIS_MODULE, DRV_DSL_CPE_API_DEV_NAME); + dsl_devt = MKDEV(DRV_DSL_CPE_API_DEV_MAJOR, 0); -+ device_create(dsl_class, NULL, dsl_devt, NULL, "dsl_cpe_api0"); ++ device_create(dsl_class, NULL, dsl_devt, NULL, "dsl_cpe_api/0"); + return 0; } diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index 3916d38701..54682a52e9 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -196,6 +196,21 @@ endef $(eval $(call KernelPackage,et131x)) +define KernelPackage/phy-microchip + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Microchip Ethernet PHY driver + KCONFIG:=CONFIG_MICROCHIP_PHY + DEPENDS:=+kmod-libphy + FILES:=$(LINUX_DIR)/drivers/net/phy/microchip.ko + AUTOLOAD:=$(call AutoLoad,18,microchip,1) +endef + +define KernelPackage/phy-microchip/description + Supports the LAN88XX PHYs. +endef + +$(eval $(call KernelPackage,phy-microchip)) + define KernelPackage/phylib-broadcom SUBMENU:=$(NETWORK_DEVICES_MENU) @@ -1019,13 +1034,28 @@ endef $(eval $(call KernelPackage,forcedeth)) +define KernelPackage/fixed-phy + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=MDIO Bus/PHY emulation with fixed speed/link PHYs + DEPENDS:=+kmod-libphy + KCONFIG:=CONFIG_FIXED_PHY + FILES:=$(LINUX_DIR)/drivers/net/phy/fixed_phy.ko + AUTOLOAD:=$(call AutoProbe,fixed_phy) +endef + +define KernelPackage/fixed-phy/description + Kernel driver for "fixed" MDIO Bus to cover the boards + and devices that use PHYs that are not connected to the real MDIO bus. +endef + +$(eval $(call KernelPackage,fixed-phy)) + define KernelPackage/of-mdio SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=OpenFirmware MDIO support - DEPENDS:=+kmod-libphy @!TARGET_x86 + DEPENDS:=+kmod-libphy +kmod-fixed-phy @!TARGET_x86 KCONFIG:=CONFIG_OF_MDIO FILES:= \ - $(LINUX_DIR)/drivers/net/phy/fixed_phy.ko \ $(LINUX_DIR)/drivers/of/of_mdio.ko@lt5.10 \ $(LINUX_DIR)/drivers/net/mdio/of_mdio.ko@ge5.10 AUTOLOAD:=$(call AutoLoad,41,of_mdio) diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk index 2d743ef442..6c815cdd76 100644 --- a/package/kernel/linux/modules/usb.mk +++ b/package/kernel/linux/modules/usb.mk @@ -1202,6 +1202,23 @@ endef $(eval $(call KernelPackage,usb-net-kaweth)) +define KernelPackage/usb-net-lan78xx + TITLE:=USB-To-Ethernet Microchip LAN78XX convertors + DEPENDS:=+kmod-fixed-phy +kmod-phy-microchip + KCONFIG:=CONFIG_USB_LAN78XX + FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/lan78xx.ko + AUTOLOAD:=$(call AutoProbe,lan78xx) + $(call AddDepends/usb-net) +endef + +define KernelPackage/usb-net-lan78xx/description + Kernel module for Microchip LAN78XX based USB 2 & USB 3 + 10/100/1000 Ethernet adapters. +endef + +$(eval $(call KernelPackage,usb-net-lan78xx)) + + define KernelPackage/usb-net-pegasus TITLE:=Kernel module for USB-to-Ethernet Pegasus convertors KCONFIG:=CONFIG_USB_PEGASUS @@ -1357,8 +1374,8 @@ $(eval $(call KernelPackage,usb-net-rtl8150)) define KernelPackage/usb-net-rtl8152 TITLE:=Kernel module for USB-to-Ethernet Realtek convertors + DEPENDS:=+r8152-firmware +kmod-crypto-sha256 +kmod-usb-net-cdc-ncm KCONFIG:=CONFIG_USB_RTL8152 - DEPENDS:=+!LINUX_5_4:kmod-crypto-sha256 +!LINUX_5_4:r8152-firmware FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/r8152.ko AUTOLOAD:=$(call AutoProbe,r8152) $(call AddDepends/usb-net, +LINUX_5_10:kmod-crypto-hash) diff --git a/package/libs/elfutils/Makefile b/package/libs/elfutils/Makefile index b0c9b8bd8c..9aa78d8352 100644 --- a/package/libs/elfutils/Makefile +++ b/package/libs/elfutils/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=elfutils -PKG_VERSION:=0.182 +PKG_VERSION:=0.186 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://sourceware.org/$(PKG_NAME)/ftp/$(PKG_VERSION) -PKG_HASH:=ecc406914edf335f0b7fc084ebe6c460c4d6d5175bfdd6688c1c78d9146b8858 +PKG_HASH:=7f6fb9149b1673d38d9178a0d3e0fb8a1ec4f53a9f4c2ff89469609879641177 PKG_MAINTAINER:=Luiz Angelo Daros de Luca PKG_LICENSE:=GPL-3.0-or-later @@ -44,7 +44,7 @@ endef define Package/libdw $(call Package/elfutils/Default) - DEPENDS:=+libelf +libbz2 + DEPENDS:=+libelf +libbz2 +USE_MUSL:musl-fts TITLE+= (libdw) endef @@ -74,6 +74,12 @@ CONFIGURE_ARGS += \ --without-lzma \ --without-zstd +HOST_CONFIGURE_VARS += \ + ac_cv_search__obstack_free=yes + +CONFIGURE_VARS += \ + ac_cv_search__obstack_free=yes + TARGET_CFLAGS += -D_GNU_SOURCE -Wno-unused-result -Wno-format-nonliteral define Build/InstallDev diff --git a/package/libs/elfutils/patches/0001-ppc_initreg.c-Incliude-asm-ptrace.h-for-pt_regs-defi.patch b/package/libs/elfutils/patches/0001-ppc_initreg.c-Incliude-asm-ptrace.h-for-pt_regs-defi.patch deleted file mode 100644 index 839f86ee6a..0000000000 --- a/package/libs/elfutils/patches/0001-ppc_initreg.c-Incliude-asm-ptrace.h-for-pt_regs-defi.patch +++ /dev/null @@ -1,29 +0,0 @@ -From http://cgit.openembedded.org/openembedded-core/plain/meta/recipes-devtools/elfutils/files/0001-ppc_initreg.c-Incliude-asm-ptrace.h-for-pt_regs-defi.patch - -From 2e2232d0935bf8ef6e66ebffba3be68a73b5b3e5 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Sun, 8 Sep 2019 15:57:59 -0700 -Subject: [PATCH] ppc_initreg.c: Incliude asm/ptrace.h for pt_regs definition - -Fixes -| ../../elfutils-0.176/backends/ppc_initreg.c:79:22: error: field 'r' has incomplete type -| struct pt_regs r; -| ^ - -Upstream-Status: Pending - -Signed-off-by: Khem Raj ---- - backends/ppc_initreg.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/backends/ppc_initreg.c -+++ b/backends/ppc_initreg.c -@@ -33,6 +33,7 @@ - #include - #if defined(__powerpc__) && defined(__linux__) - # include -+# include - # include - #endif - diff --git a/package/libs/elfutils/patches/003-libintl-compatibility.patch b/package/libs/elfutils/patches/003-libintl-compatibility.patch index 26fcc85c8b..3254dcffb2 100644 --- a/package/libs/elfutils/patches/003-libintl-compatibility.patch +++ b/package/libs/elfutils/patches/003-libintl-compatibility.patch @@ -11,9 +11,9 @@ Requires.private: zlib --- a/configure.ac +++ b/configure.ac -@@ -590,6 +590,9 @@ AC_CONFIG_FILES([config/libelf.pc config - AC_SUBST(USE_NLS, yes) - AM_PO_SUBDIRS +@@ -610,6 +610,9 @@ dnl AM_GNU_GETTEXT_REQUIRE_VERSION suppo + AM_GNU_GETTEXT_VERSION([0.19.6]) + AM_GNU_GETTEXT_REQUIRE_VERSION([0.19.6]) +case "$USE_NLS" in yes) intl_LDFLAGS="-lintl" ;; esac +AC_SUBST([intl_LDFLAGS]) @@ -21,51 +21,3 @@ dnl Appended to the config.h file. dnl We hide all kinds of configuration magic in lib/eu-config.h. AH_BOTTOM([#include ]) ---- a/libasm/libasmP.h -+++ b/libasm/libasmP.h -@@ -36,6 +36,9 @@ - - #include "libdwelf.h" - -+#ifdef _ /* fix libintl-stub */ -+#undef _ -+#endif - /* gettext helper macros. */ - #define _(Str) dgettext ("elfutils", Str) - ---- a/libdw/libdwP.h -+++ b/libdw/libdwP.h -@@ -37,6 +37,9 @@ - #include - #include "atomics.h" - -+#ifdef _ /* fix libintl-stub */ -+#undef _ -+#endif - - /* gettext helper macros. */ - #define _(Str) dgettext ("elfutils", Str) ---- a/libdwfl/libdwflP.h -+++ b/libdwfl/libdwflP.h -@@ -47,6 +47,9 @@ - - typedef struct Dwfl_Process Dwfl_Process; - -+#ifdef _ /* fix libintl-stub */ -+#undef _ -+#endif - /* gettext helper macros. */ - #define _(Str) dgettext ("elfutils", Str) - ---- a/libelf/libelfP.h -+++ b/libelf/libelfP.h -@@ -39,6 +39,9 @@ - #include - #include - -+#ifdef _ /* fix libintl-stub */ -+#undef _ -+#endif - /* gettext helper macros. */ - #define _(Str) dgettext ("elfutils", Str) - diff --git a/package/libs/elfutils/patches/005-build_only_libs.patch b/package/libs/elfutils/patches/005-build_only_libs.patch index 501348f21c..304b85c47a 100644 --- a/package/libs/elfutils/patches/005-build_only_libs.patch +++ b/package/libs/elfutils/patches/005-build_only_libs.patch @@ -3,7 +3,7 @@ @@ -27,7 +27,7 @@ AM_MAKEFLAGS = --no-print-directory pkginclude_HEADERS = version.h - SUBDIRS = config m4 lib libelf libcpu backends libebl libdwelf libdwfl libdw \ + SUBDIRS = config lib libelf libcpu backends libebl libdwelf libdwfl libdw \ - libasm debuginfod src po doc tests + libasm diff --git a/package/libs/elfutils/patches/100-musl-compat.patch b/package/libs/elfutils/patches/100-musl-compat.patch index 508ff9e946..52b9f2c43b 100644 --- a/package/libs/elfutils/patches/100-musl-compat.patch +++ b/package/libs/elfutils/patches/100-musl-compat.patch @@ -1,27 +1,3 @@ -https://sourceware.org/bugzilla/show_bug.cgi?id=21002 - ---- a/lib/system.h -+++ b/lib/system.h -@@ -30,7 +30,18 @@ - #define LIB_SYSTEM_H 1 - - #include --#include -+#ifdef HAVE_ERROR_H -+#include "error.h" -+#else -+#include "err.h" -+#include -+#define error(status, errno, ...) \ -+ do { \ -+ fflush(stdout); \ -+ warn(__VA_ARGS__); \ -+ if (status) exit(status); \ -+ } while(0) -+#endif - #include - #include - #include --- a/libdw/libdw_alloc.c +++ b/libdw/libdw_alloc.c @@ -152,5 +152,5 @@ __attribute ((noreturn)) attribute_hidde @@ -33,15 +9,21 @@ https://sourceware.org/bugzilla/show_bug.cgi?id=21002 } --- a/libdwfl/dwfl_error.c +++ b/libdwfl/dwfl_error.c -@@ -154,7 +154,11 @@ dwfl_errmsg (int error) - switch (error &~ 0xffff) - { - case OTHER_ERROR (ERRNO): +@@ -140,6 +140,7 @@ __libdwfl_seterrno (Dwfl_Error error) + static const char * + errnomsg(int error) + { +#if defined(__GLIBC__) && !defined(__UCLIBC__) - return strerror_r (error & 0xffff, "bad", 0); + /* Won't be changed by strerror_r, but not const so compiler doesn't throw warning */ + static char unknown[] = "unknown error"; + +@@ -150,6 +151,9 @@ errnomsg(int error) + static __thread char msg[128]; + return strerror_r (error, msg, sizeof (msg)) ? unknown : msg; + #endif +#else -+ return strerror (error & 0xffff); ++ return strerror (error & 0xffff); +#endif - case OTHER_ERROR (LIBELF): - return elf_errmsg (error & 0xffff); - case OTHER_ERROR (LIBDW): + } + + const char * diff --git a/package/libs/elfutils/patches/101-no-fts.patch b/package/libs/elfutils/patches/101-no-fts.patch index 29ec9ecac0..c4f0b88233 100644 --- a/package/libs/elfutils/patches/101-no-fts.patch +++ b/package/libs/elfutils/patches/101-no-fts.patch @@ -1,6 +1,6 @@ --- a/libdwfl/argp-std.c +++ b/libdwfl/argp-std.c -@@ -56,9 +56,6 @@ static const struct argp_option options[ +@@ -53,9 +53,6 @@ static const struct argp_option options[ { "linux-process-map", 'M', "FILE", 0, N_("Find addresses in files mapped as read from FILE" " in Linux /proc/PID/maps format"), 0 }, @@ -10,7 +10,7 @@ { "debuginfo-path", OPT_DEBUGINFO, "PATH", 0, N_("Search path for separate debuginfo files"), 0 }, { NULL, 0, NULL, 0, NULL, 0 } -@@ -85,15 +82,6 @@ static const Dwfl_Callbacks proc_callbac +@@ -82,15 +79,6 @@ static const Dwfl_Callbacks proc_callbac .find_elf = INTUSE(dwfl_linux_proc_find_elf), }; @@ -26,7 +26,7 @@ /* Structure held at state->HOOK. */ struct parse_opt { -@@ -226,43 +214,6 @@ parse_opt (int key, char *arg, struct ar +@@ -223,43 +211,6 @@ parse_opt (int key, char *arg, struct ar } break; diff --git a/package/libs/elfutils/patches/110-no-cdefs.patch b/package/libs/elfutils/patches/110-no-cdefs.patch deleted file mode 100644 index d66f1e924f..0000000000 --- a/package/libs/elfutils/patches/110-no-cdefs.patch +++ /dev/null @@ -1,26 +0,0 @@ -From e399540ab67ffe83ca3c4cb768a2f0f2f32a9057 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Sun, 5 Apr 2020 15:56:59 -0700 -Subject: [PATCH] libelf: remove usage of sys/cdefs - -sys/cdefs is a deprecated glibc header that is unavailable with other -libc implementations such as musl. - -features.h under glibc includes sys/cdefs whereas it does not under musl. - -Signed-off-by: Rosen Penev ---- - lib/fixedsizehash.h | 1 - - libelf/elf.h | 10 ++++++---- - 2 files changed, 6 insertions(+), 5 deletions(-) - ---- a/lib/fixedsizehash.h -+++ b/lib/fixedsizehash.h -@@ -30,7 +30,6 @@ - #include - #include - #include --#include - - #include - diff --git a/package/libs/mbedtls/patches/200-config.patch b/package/libs/mbedtls/patches/200-config.patch index 1e3d41f0eb..67f331674c 100644 --- a/package/libs/mbedtls/patches/200-config.patch +++ b/package/libs/mbedtls/patches/200-config.patch @@ -126,15 +126,6 @@ /** * \def MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO -@@ -1690,7 +1690,7 @@ - * - * Comment this macro to disable support for SSL session tickets - */ --#define MBEDTLS_SSL_SESSION_TICKETS -+//#define MBEDTLS_SSL_SESSION_TICKETS - - /** - * \def MBEDTLS_SSL_EXPORT_KEYS @@ -1720,7 +1720,7 @@ * * Comment this macro to disable support for truncated HMAC in SSL @@ -216,15 +207,6 @@ /** * \def MBEDTLS_RSA_C -@@ -2913,7 +2913,7 @@ - * - * Requires: MBEDTLS_CIPHER_C - */ --#define MBEDTLS_SSL_TICKET_C -+//#define MBEDTLS_SSL_TICKET_C - - /** - * \def MBEDTLS_SSL_CLI_C @@ -3013,7 +3013,7 @@ * * This module provides run-time version information. diff --git a/package/libs/toolchain/Makefile b/package/libs/toolchain/Makefile index dea99060f9..682efd1970 100644 --- a/package/libs/toolchain/Makefile +++ b/package/libs/toolchain/Makefile @@ -519,10 +519,9 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) $(INSTALL_DIR) $(1)/lib $(CP) \ $(TOOLCHAIN_DIR)/lib/ld*.so.* \ - $(TOOLCHAIN_DIR)/lib/ld-$(LIBC_SO_VERSION).so \ $(1)/lib/ for file in libanl libc libcidn libcrypt libdl libm libnsl libnss_dns libnss_files libresolv libutil; do \ - for file in $(TOOLCHAIN_DIR)/lib/$$$$file.so.* $(TOOLCHAIN_DIR)/lib/$$$$file-$(LIBC_SO_VERSION).so; do \ + for file in $(TOOLCHAIN_DIR)/lib/$$$$file.so.*; do \ if [ -e "$$$$file" ]; then \ $(CP) $$$$file $(1)/lib/; \ fi; \ @@ -561,7 +560,6 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) ifneq ($(CONFIG_USE_MUSL),y) $(CP) \ $(TOOLCHAIN_DIR)/lib/libpthread.so.* \ - $(TOOLCHAIN_DIR)/lib/libpthread-$(LIBC_SO_VERSION).so \ $(1)/lib/ endif endef @@ -581,7 +579,6 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) ifneq ($(CONFIG_USE_MUSL),y) $(CP) \ $(TOOLCHAIN_DIR)/lib/librt.so.* \ - $(TOOLCHAIN_DIR)/lib/librt-$(LIBC_SO_VERSION).so \ $(1)/lib/ endif endef diff --git a/package/network/config/firewall/Makefile b/package/network/config/firewall/Makefile index c196e53770..3146140905 100644 --- a/package/network/config/firewall/Makefile +++ b/package/network/config/firewall/Makefile @@ -9,13 +9,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=firewall -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firewall3.git -PKG_SOURCE_DATE:=2021-08-14 -PKG_SOURCE_VERSION:=40e5f6a2bd0b5406eff7e1d2d4f95bbf8f9410a4 -PKG_MIRROR_HASH:=4acd7d3c688d31a07ad871dcdbcd06d975ac86745d9f3a6caed68e694635965c +PKG_SOURCE_DATE:=2022-01-10 +PKG_SOURCE_VERSION:=0f16ea5f055722a532d4e68c7ba34ed084b48b37 +PKG_MIRROR_HASH:=219478ef95b170b5122030715eac7b3317f2ac4d67e1a936c22a78b10e056123 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC @@ -28,7 +28,10 @@ define Package/firewall SECTION:=net CATEGORY:=Base system TITLE:=OpenWrt C Firewall - DEPENDS:=+libubox +libubus +libuci +libip4tc +IPV6:libip6tc +libxtables +kmod-ipt-core +kmod-ipt-conntrack +IPV6:kmod-nf-conntrack6 +kmod-ipt-nat +iptables-mod-fullconenat + DEPENDS:=+libubox +libubus +libuci +libip4tc +IPV6:libip6tc +libxtables +kmod-ipt-core \ + +kmod-ipt-conntrack +IPV6:kmod-nf-conntrack6 +kmod-ipt-nat +iptables-mod-fullconenat + PROVIDES:=uci-firewall + CONFLICTS:=firewall4 endef define Package/firewall/description diff --git a/package/network/config/firewall4/Makefile b/package/network/config/firewall4/Makefile index a4f63a91ee..94aa278774 100644 --- a/package/network/config/firewall4/Makefile +++ b/package/network/config/firewall4/Makefile @@ -9,9 +9,9 @@ PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firewall4.git -PKG_SOURCE_DATE:=2021-10-25 -PKG_SOURCE_VERSION:=eb0a3ee812d48f1faecbf6258c293e475b4016a0 -PKG_MIRROR_HASH:=46b5bdea13a285dbd1b3432fe8cfd8cb98a2797b86b176d7762e0987ec2f230c +PKG_SOURCE_DATE:=2022-01-09 +PKG_SOURCE_VERSION:=07579df54f38d75afea44b2a3b41a6d9af9497a1 +PKG_MIRROR_HASH:=3326e5e9fd53fe9f679b62cdada83aea4951aefe95ed6d2b5eca5a4695add45c PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC @@ -21,8 +21,12 @@ define Package/firewall4 SECTION:=net CATEGORY:=Base system TITLE:=OpenWrt 4th gen firewall - DEPENDS:=+ucode +ucode-mod-fs +ucode-mod-uci +ucode-mod-ubus +kmod-nft-core +kmod-nft-fib +kmod-nft-nat +kmod-nft-nat6 +nftables-json - CONFLICTS:=firewall kmod-ipt-nat + DEPENDS:= \ + +kmod-nft-core +kmod-nft-fib +kmod-nft-offload \ + +kmod-nft-nat +kmod-nft-nat6 \ + +nftables-json \ + +ucode +ucode-mod-fs +ucode-mod-ubus +ucode-mod-uci + PROVIDES:=uci-firewall endef define Package/firewall4/description diff --git a/package/network/config/ltq-vdsl-app/patches/100-compat.patch b/package/network/config/ltq-vdsl-app/patches/100-compat.patch index 6b738cfe66..6bc359c3cc 100644 --- a/package/network/config/ltq-vdsl-app/patches/100-compat.patch +++ b/package/network/config/ltq-vdsl-app/patches/100-compat.patch @@ -9,14 +9,3 @@ DSL_CPE_SIC_SET(DSL_TC_ATM, DSL_EMF_TC_CLEANED, DSL_EMF_TC_CLEANED, DSL_SYSTEMIF_MII, \ DSL_TC_EFM, DSL_EMF_TC_CLEANED, DSL_EMF_TC_CLEANED, DSL_SYSTEMIF_MII), DSL_CPE_MAC_CFG_SET(DSL_EFM_SPEED_100, DSL_EFM_DUPLEX_FULL, DSL_EFM_FLOWCTRL_ON, DSL_EFM_AUTONEG_OFF, \ ---- a/src/dsl_cpe_control.c -+++ b/src/dsl_cpe_control.c -@@ -6761,7 +6761,7 @@ DSL_int_t dsl_cpe_daemon ( - for (nDevice = 0; nDevice < DSL_CPE_MAX_DSL_ENTITIES; nDevice++) - { - #if defined(INCLUDE_DSL_CPE_API_VRX) -- sprintf (device, "%s/%d", DSL_CPE_DEVICE_NAME, nDevice); -+ sprintf (device, "%s%d", DSL_CPE_DEVICE_NAME, nDevice); - #else - sprintf (device, "%s", DSL_CPE_DEVICE_NAME); - #endif /* defined(INCLUDE_DSL_CPE_API_VRX)*/ diff --git a/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c b/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c index 707acdc606..93eecaf71d 100644 --- a/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c +++ b/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c @@ -735,7 +735,7 @@ static int metrics(struct ubus_context *ctx, struct ubus_object *obj, vector_t vector = VECTOR_UNKNOWN; #ifndef INCLUDE_DSL_CPE_API_DANUBE - fd = open(DSL_CPE_DEVICE_NAME "0", O_RDWR, 0644); + fd = open(DSL_CPE_DEVICE_NAME "/0", O_RDWR, 0644); #else fd = open(DSL_CPE_DEVICE_NAME, O_RDWR, 0644); #endif diff --git a/package/system/opkg/Makefile b/package/system/opkg/Makefile index bd9fab474c..8ac822f17e 100644 --- a/package/system/opkg/Makefile +++ b/package/system/opkg/Makefile @@ -12,9 +12,9 @@ PKG_FLAGS:=essential PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/opkg-lede.git -PKG_SOURCE_DATE:=2021-06-13 -PKG_SOURCE_VERSION:=1bf042dd06751b693a8544d2317e5b969d666b69 -PKG_MIRROR_HASH:=aeda4e0f11805bf95fc7be6d38391ce579acd965c8ba6a490b3e8669815b7264 +PKG_SOURCE_DATE:=2022-01-09 +PKG_SOURCE_VERSION:=2edcfad1bb9a32f31199d5842aa087b4d30ec6f5 +PKG_MIRROR_HASH:=b21e51ffe5bae3ca01865415630cc1f4b471f69e0d7947264a579165c7d44294 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING diff --git a/package/utils/busybox/Config-defaults.in b/package/utils/busybox/Config-defaults.in index 899da59c21..c1702f2aeb 100644 --- a/package/utils/busybox/Config-defaults.in +++ b/package/utils/busybox/Config-defaults.in @@ -211,15 +211,24 @@ config BUSYBOX_DEFAULT_MD5_SMALL config BUSYBOX_DEFAULT_SHA3_SMALL int default 1 -config BUSYBOX_DEFAULT_FEATURE_FAST_TOP +config BUSYBOX_DEFAULT_FEATURE_NON_POSIX_CP bool default y -config BUSYBOX_DEFAULT_FEATURE_ETC_NETWORKS +config BUSYBOX_DEFAULT_FEATURE_VERBOSE_CP_MESSAGE bool default n -config BUSYBOX_DEFAULT_FEATURE_ETC_SERVICES +config BUSYBOX_DEFAULT_FEATURE_USE_SENDFILE bool - default n + default y +config BUSYBOX_DEFAULT_FEATURE_COPYBUF_KB + int + default 4 +config BUSYBOX_DEFAULT_MONOTONIC_SYSCALL + bool + default y +config BUSYBOX_DEFAULT_IOCTL_HEX2STR_ERROR + bool + default y config BUSYBOX_DEFAULT_FEATURE_EDITING bool default y @@ -289,30 +298,6 @@ config BUSYBOX_DEFAULT_UNICODE_NEUTRAL_TABLE config BUSYBOX_DEFAULT_UNICODE_PRESERVE_BROKEN bool default n -config BUSYBOX_DEFAULT_FEATURE_NON_POSIX_CP - bool - default y -config BUSYBOX_DEFAULT_FEATURE_VERBOSE_CP_MESSAGE - bool - default n -config BUSYBOX_DEFAULT_FEATURE_USE_SENDFILE - bool - default y -config BUSYBOX_DEFAULT_FEATURE_COPYBUF_KB - int - default 4 -config BUSYBOX_DEFAULT_FEATURE_SKIP_ROOTFS - bool - default n -config BUSYBOX_DEFAULT_MONOTONIC_SYSCALL - bool - default y -config BUSYBOX_DEFAULT_IOCTL_HEX2STR_ERROR - bool - default y -config BUSYBOX_DEFAULT_FEATURE_HWIB - bool - default n config BUSYBOX_DEFAULT_FEATURE_SEAMLESS_XZ bool default n @@ -391,6 +376,12 @@ config BUSYBOX_DEFAULT_FEATURE_CPIO_O config BUSYBOX_DEFAULT_FEATURE_CPIO_P bool default n +config BUSYBOX_DEFAULT_FEATURE_CPIO_IGNORE_DEVNO + bool + default n +config BUSYBOX_DEFAULT_FEATURE_CPIO_RENUMBER_INODES + bool + default n config BUSYBOX_DEFAULT_DPKG bool default n @@ -484,6 +475,18 @@ config BUSYBOX_DEFAULT_FEATURE_UNZIP_XZ config BUSYBOX_DEFAULT_FEATURE_LZMA_FAST bool default n +config BUSYBOX_DEFAULT_FEATURE_VERBOSE + bool + default n +config BUSYBOX_DEFAULT_FEATURE_TIMEZONE + bool + default n +config BUSYBOX_DEFAULT_FEATURE_PRESERVE_HARDLINKS + bool + default y +config BUSYBOX_DEFAULT_FEATURE_HUMAN_READABLE + bool + default y config BUSYBOX_DEFAULT_BASENAME bool default y @@ -568,6 +571,9 @@ config BUSYBOX_DEFAULT_DF config BUSYBOX_DEFAULT_FEATURE_DF_FANCY bool default n +config BUSYBOX_DEFAULT_FEATURE_SKIP_ROOTFS + bool + default n config BUSYBOX_DEFAULT_DIRNAME bool default y @@ -908,15 +914,6 @@ config BUSYBOX_DEFAULT_WHOAMI config BUSYBOX_DEFAULT_YES bool default y -config BUSYBOX_DEFAULT_FEATURE_VERBOSE - bool - default n -config BUSYBOX_DEFAULT_FEATURE_PRESERVE_HARDLINKS - bool - default y -config BUSYBOX_DEFAULT_FEATURE_HUMAN_READABLE - bool - default y config BUSYBOX_DEFAULT_CHVT bool default n @@ -1118,9 +1115,21 @@ config BUSYBOX_DEFAULT_FEATURE_FIND_PRINT0 config BUSYBOX_DEFAULT_FEATURE_FIND_MTIME bool default y +config BUSYBOX_DEFAULT_FEATURE_FIND_ATIME + bool + default n +config BUSYBOX_DEFAULT_FEATURE_FIND_CTIME + bool + default n config BUSYBOX_DEFAULT_FEATURE_FIND_MMIN bool default y +config BUSYBOX_DEFAULT_FEATURE_FIND_AMIN + bool + default n +config BUSYBOX_DEFAULT_FEATURE_FIND_CMIN + bool + default n config BUSYBOX_DEFAULT_FEATURE_FIND_PERM bool default y @@ -1142,6 +1151,9 @@ config BUSYBOX_DEFAULT_FEATURE_FIND_NEWER config BUSYBOX_DEFAULT_FEATURE_FIND_INUM bool default n +config BUSYBOX_DEFAULT_FEATURE_FIND_SAMEFILE + bool + default n config BUSYBOX_DEFAULT_FEATURE_FIND_EXEC bool default y @@ -2211,6 +2223,15 @@ config BUSYBOX_DEFAULT_FEATURE_PREFER_IPV4_ADDRESS config BUSYBOX_DEFAULT_VERBOSE_RESOLUTION_ERRORS bool default y +config BUSYBOX_DEFAULT_FEATURE_ETC_NETWORKS + bool + default n +config BUSYBOX_DEFAULT_FEATURE_ETC_SERVICES + bool + default n +config BUSYBOX_DEFAULT_FEATURE_HWIB + bool + default n config BUSYBOX_DEFAULT_FEATURE_TLS_SHA1 bool default n @@ -2265,6 +2286,9 @@ config BUSYBOX_DEFAULT_DNSDOMAINNAME config BUSYBOX_DEFAULT_HTTPD bool default n +config BUSYBOX_DEFAULT_FEATURE_HTTPD_PORT_DEFAULT + int + default 80 config BUSYBOX_DEFAULT_FEATURE_HTTPD_RANGES bool default n @@ -2544,6 +2568,9 @@ config BUSYBOX_DEFAULT_TELNETD config BUSYBOX_DEFAULT_FEATURE_TELNETD_STANDALONE bool default n +config BUSYBOX_DEFAULT_FEATURE_TELNETD_PORT_DEFAULT + int + default 23 config BUSYBOX_DEFAULT_FEATURE_TELNETD_INETD_WAIT bool default n @@ -2700,6 +2727,9 @@ config BUSYBOX_DEFAULT_LPR config BUSYBOX_DEFAULT_LPQ bool default n +config BUSYBOX_DEFAULT_FEATURE_MIME_CHARSET + string + default "" config BUSYBOX_DEFAULT_MAKEMIME bool default n @@ -2718,9 +2748,12 @@ config BUSYBOX_DEFAULT_FEATURE_REFORMIME_COMPAT config BUSYBOX_DEFAULT_SENDMAIL bool default n -config BUSYBOX_DEFAULT_FEATURE_MIME_CHARSET - string - default "" +config BUSYBOX_DEFAULT_FEATURE_FAST_TOP + bool + default y +config BUSYBOX_DEFAULT_FEATURE_SHOW_THREADS + bool + default n config BUSYBOX_DEFAULT_FREE bool default y @@ -2835,9 +2868,6 @@ config BUSYBOX_DEFAULT_FEATURE_UPTIME_UTMP_SUPPORT config BUSYBOX_DEFAULT_WATCH bool default n -config BUSYBOX_DEFAULT_FEATURE_SHOW_THREADS - bool - default n config BUSYBOX_DEFAULT_CHPST bool default n diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile index 90d323b92b..2861e7d2e9 100644 --- a/package/utils/busybox/Makefile +++ b/package/utils/busybox/Makefile @@ -5,14 +5,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=busybox -PKG_VERSION:=1.34.1 +PKG_VERSION:=1.35.0 PKG_RELEASE:=$(AUTORELEASE) PKG_FLAGS:=essential PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://www.busybox.net/downloads \ http://sources.buildroot.net -PKG_HASH:=415fbd89e5344c96acf449d94a6f956dbed62e18e835fc83e064db33a34bd549 +PKG_HASH:=faeeb244c35a348a334f4a59e44626ee870fb07b6884d68c10ae8bc19f83a694 PKG_BUILD_DEPENDS:=BUSYBOX_CONFIG_PAM:libpam PKG_BUILD_PARALLEL:=1 diff --git a/package/utils/busybox/config/archival/Config.in b/package/utils/busybox/config/archival/Config.in index ea167a46af..ac2b3d2056 100644 --- a/package/utils/busybox/config/archival/Config.in +++ b/package/utils/busybox/config/archival/Config.in @@ -204,6 +204,20 @@ config BUSYBOX_CONFIG_FEATURE_CPIO_P depends on BUSYBOX_CONFIG_FEATURE_CPIO_O help Passthrough mode. Rarely used. + +config BUSYBOX_CONFIG_FEATURE_CPIO_IGNORE_DEVNO + bool "Support --ignore-devno like GNU cpio" + default BUSYBOX_DEFAULT_FEATURE_CPIO_IGNORE_DEVNO + depends on BUSYBOX_CONFIG_FEATURE_CPIO_O && BUSYBOX_CONFIG_LONG_OPTS + help + Optionally ignore device numbers when creating archives. + +config BUSYBOX_CONFIG_FEATURE_CPIO_RENUMBER_INODES + bool "Support --renumber-inodes like GNU cpio" + default BUSYBOX_DEFAULT_FEATURE_CPIO_RENUMBER_INODES + depends on BUSYBOX_CONFIG_FEATURE_CPIO_O && BUSYBOX_CONFIG_LONG_OPTS + help + Optionally renumber inodes when creating archives. config BUSYBOX_CONFIG_DPKG bool "dpkg (43 kb)" default BUSYBOX_DEFAULT_DPKG diff --git a/package/utils/busybox/config/coreutils/Config.in b/package/utils/busybox/config/coreutils/Config.in index c84c1d5a94..835ce7950a 100644 --- a/package/utils/busybox/config/coreutils/Config.in +++ b/package/utils/busybox/config/coreutils/Config.in @@ -6,6 +6,47 @@ menu "Coreutils" +config BUSYBOX_CONFIG_FEATURE_VERBOSE + bool "Support verbose options (usually -v) for various applets" + default BUSYBOX_DEFAULT_FEATURE_VERBOSE + help + Enable cp -v, rm -v and similar messages. + Also enables long option (--verbose) if it exists. + Without this option, -v is accepted but ignored. + +comment "Common options for date and touch" + +config BUSYBOX_CONFIG_FEATURE_TIMEZONE + bool "Allow timezone in dates" + default BUSYBOX_DEFAULT_FEATURE_TIMEZONE + depends on BUSYBOX_CONFIG_DESKTOP + help + Permit the use of timezones when parsing user-provided data + strings, e.g. '1996-04-09 12:45:00 -0500'. + + This requires support for the '%z' extension to strptime() which + may not be available in all implementations. + +comment "Common options for cp and mv" + depends on BUSYBOX_CONFIG_CP || BUSYBOX_CONFIG_MV + +config BUSYBOX_CONFIG_FEATURE_PRESERVE_HARDLINKS + bool "Preserve hard links" + default BUSYBOX_DEFAULT_FEATURE_PRESERVE_HARDLINKS + depends on BUSYBOX_CONFIG_CP || BUSYBOX_CONFIG_MV + help + Allow cp and mv to preserve hard links. + +comment "Common options for df, du, ls" + depends on BUSYBOX_CONFIG_DF || BUSYBOX_CONFIG_DU || BUSYBOX_CONFIG_LS + +config BUSYBOX_CONFIG_FEATURE_HUMAN_READABLE + bool "Support human readable output (example 13k, 23M, 235G)" + default BUSYBOX_DEFAULT_FEATURE_HUMAN_READABLE + depends on BUSYBOX_CONFIG_DF || BUSYBOX_CONFIG_DU || BUSYBOX_CONFIG_LS + help + Allow df, du, and ls to have human readable output. + config BUSYBOX_CONFIG_BASENAME bool "basename (438 bytes)" default BUSYBOX_DEFAULT_BASENAME @@ -200,6 +241,26 @@ config BUSYBOX_CONFIG_FEATURE_DF_FANCY -a Show all filesystems -i Inodes -B Blocksize + +config BUSYBOX_CONFIG_FEATURE_SKIP_ROOTFS + bool "Skip rootfs in mount table" + default BUSYBOX_DEFAULT_FEATURE_SKIP_ROOTFS + depends on BUSYBOX_CONFIG_DF + help + Ignore rootfs entry in mount table. + + In Linux, kernel has a special filesystem, rootfs, which is initially + mounted on /. It contains initramfs data, if kernel is configured + to have one. Usually, another file system is mounted over / early + in boot process, and therefore most tools which manipulate + mount table, such as df, will skip rootfs entry. + + However, some systems do not mount anything on /. + If you need to configure busybox for one of these systems, + you may find it useful to turn this option off to make df show + initramfs statistics. + + Otherwise, choose Y. config BUSYBOX_CONFIG_DIRNAME bool "dirname (329 bytes)" default BUSYBOX_DEFAULT_DIRNAME @@ -896,34 +957,4 @@ config BUSYBOX_CONFIG_YES yes is used to repeatedly output a specific string, or the default string 'y'. -comment "Common options" - -config BUSYBOX_CONFIG_FEATURE_VERBOSE - bool "Support verbose options (usually -v) for various applets" - default BUSYBOX_DEFAULT_FEATURE_VERBOSE - help - Enable cp -v, rm -v and similar messages. - Also enables long option (--verbose) if it exists. - Without this option, -v is accepted but ignored. - -comment "Common options for cp and mv" - depends on BUSYBOX_CONFIG_CP || BUSYBOX_CONFIG_MV - -config BUSYBOX_CONFIG_FEATURE_PRESERVE_HARDLINKS - bool "Preserve hard links" - default BUSYBOX_DEFAULT_FEATURE_PRESERVE_HARDLINKS - depends on BUSYBOX_CONFIG_CP || BUSYBOX_CONFIG_MV - help - Allow cp and mv to preserve hard links. - -comment "Common options for df, du, ls" - depends on BUSYBOX_CONFIG_DF || BUSYBOX_CONFIG_DU || BUSYBOX_CONFIG_LS - -config BUSYBOX_CONFIG_FEATURE_HUMAN_READABLE - bool "Support human readable output (example 13k, 23M, 235G)" - default BUSYBOX_DEFAULT_FEATURE_HUMAN_READABLE - depends on BUSYBOX_CONFIG_DF || BUSYBOX_CONFIG_DU || BUSYBOX_CONFIG_LS - help - Allow df, du, and ls to have human readable output. - endmenu diff --git a/package/utils/busybox/config/findutils/Config.in b/package/utils/busybox/config/findutils/Config.in index 89901ca59d..805d44f149 100644 --- a/package/utils/busybox/config/findutils/Config.in +++ b/package/utils/busybox/config/findutils/Config.in @@ -23,21 +23,53 @@ config BUSYBOX_CONFIG_FEATURE_FIND_PRINT0 interpreted by other programs. config BUSYBOX_CONFIG_FEATURE_FIND_MTIME - bool "Enable -mtime: modified time matching" + bool "Enable -mtime: modification time matching" default BUSYBOX_DEFAULT_FEATURE_FIND_MTIME depends on BUSYBOX_CONFIG_FIND help Allow searching based on the modification time of files, in days. +config BUSYBOX_CONFIG_FEATURE_FIND_ATIME + bool "Enable -atime: access time matching" + default BUSYBOX_DEFAULT_FEATURE_FIND_ATIME + depends on BUSYBOX_CONFIG_FEATURE_FIND_MTIME + help + Allow searching based on the access time of + files, in days. + +config BUSYBOX_CONFIG_FEATURE_FIND_CTIME + bool "Enable -ctime: status change timestamp matching" + default BUSYBOX_DEFAULT_FEATURE_FIND_CTIME + depends on BUSYBOX_CONFIG_FEATURE_FIND_MTIME + help + Allow searching based on the status change timestamp of + files, in days. + config BUSYBOX_CONFIG_FEATURE_FIND_MMIN - bool "Enable -mmin: modified time matching by minutes" + bool "Enable -mmin: modification time matching by minutes" default BUSYBOX_DEFAULT_FEATURE_FIND_MMIN depends on BUSYBOX_CONFIG_FIND help Allow searching based on the modification time of files, in minutes. +config BUSYBOX_CONFIG_FEATURE_FIND_AMIN + bool "Enable -amin: access time matching by minutes" + default BUSYBOX_DEFAULT_FEATURE_FIND_AMIN + depends on BUSYBOX_CONFIG_FEATURE_FIND_MMIN + help + Allow searching based on the access time of + files, in minutes. + +config BUSYBOX_CONFIG_FEATURE_FIND_CMIN + bool "Enable -cmin: status change timestamp matching by minutes" + default BUSYBOX_DEFAULT_FEATURE_FIND_CMIN + depends on BUSYBOX_CONFIG_FEATURE_FIND_MMIN + help + Allow searching based on the status change timestamp of + files, in minutes. + config BUSYBOX_CONFIG_FEATURE_FIND_PERM bool "Enable -perm: permissions matching" default BUSYBOX_DEFAULT_FEATURE_FIND_PERM @@ -79,6 +111,13 @@ config BUSYBOX_CONFIG_FEATURE_FIND_INUM default BUSYBOX_DEFAULT_FEATURE_FIND_INUM depends on BUSYBOX_CONFIG_FIND +config BUSYBOX_CONFIG_FEATURE_FIND_SAMEFILE + bool "Enable -samefile: reference file matching" + default BUSYBOX_DEFAULT_FEATURE_FIND_SAMEFILE + depends on BUSYBOX_CONFIG_FIND + help + Support the 'find -samefile' option for searching by a reference file. + config BUSYBOX_CONFIG_FEATURE_FIND_EXEC bool "Enable -exec: execute commands" default BUSYBOX_DEFAULT_FEATURE_FIND_EXEC diff --git a/package/utils/busybox/config/libbb/Config.in b/package/utils/busybox/config/libbb/Config.in index 906649c5c9..e050c4a915 100644 --- a/package/utils/busybox/config/libbb/Config.in +++ b/package/utils/busybox/config/libbb/Config.in @@ -117,32 +117,73 @@ config BUSYBOX_CONFIG_SHA3_SMALL 64-bit x86: +270 bytes of code, 45% faster 32-bit x86: +450 bytes of code, 75% faster -config BUSYBOX_CONFIG_FEATURE_FAST_TOP - bool "Faster /proc scanning code (+100 bytes)" - default BUSYBOX_DEFAULT_FEATURE_FAST_TOP # all "fast or small" options default to small +config BUSYBOX_CONFIG_FEATURE_NON_POSIX_CP + bool "Non-POSIX, but safer, copying to special nodes" + default BUSYBOX_DEFAULT_FEATURE_NON_POSIX_CP help - This option makes top and ps ~20% faster (or 20% less CPU hungry), - but code size is slightly bigger. + With this option, "cp file symlink" will delete symlink + and create a regular file. This does not conform to POSIX, + but prevents a symlink attack. + Similarly, "cp file device" will not send file's data + to the device. (To do that, use "cat file >device") -config BUSYBOX_CONFIG_FEATURE_ETC_NETWORKS - bool "Support /etc/networks" - default BUSYBOX_DEFAULT_FEATURE_ETC_NETWORKS +config BUSYBOX_CONFIG_FEATURE_VERBOSE_CP_MESSAGE + bool "Give more precise messages when copy fails (cp, mv etc)" + default BUSYBOX_DEFAULT_FEATURE_VERBOSE_CP_MESSAGE help - Enable support for network names in /etc/networks. This is - a rarely used feature which allows you to use names - instead of IP/mask pairs in route command. + Error messages with this feature enabled: -config BUSYBOX_CONFIG_FEATURE_ETC_SERVICES - bool "Consult /etc/services even for well-known ports" - default BUSYBOX_DEFAULT_FEATURE_ETC_SERVICES + $ cp file /does_not_exist/file + cp: cannot create '/does_not_exist/file': Path does not exist + $ cp file /vmlinuz/file + cp: cannot stat '/vmlinuz/file': Path has non-directory component + + If this feature is not enabled, they will be, respectively: + + cp: cannot create '/does_not_exist/file': No such file or directory + cp: cannot stat '/vmlinuz/file': Not a directory + + This will cost you ~60 bytes. + +config BUSYBOX_CONFIG_FEATURE_USE_SENDFILE + bool "Use sendfile system call" + default BUSYBOX_DEFAULT_FEATURE_USE_SENDFILE help - Look up e.g. "telnet" and "http" in /etc/services file - instead of assuming ports 23 and 80. - This is almost never necessary (everybody uses standard ports), - and it makes sense to avoid reading this file. - If you disable this option, in the cases where port is explicitly - specified as a service name (e.g. "telnet HOST PORTNAME"), - it will still be looked up in /etc/services. + When enabled, busybox will use the kernel sendfile() function + instead of read/write loops to copy data between file descriptors + (for example, cp command does this a lot). + If sendfile() doesn't work, copying code falls back to read/write + loop. sendfile() was originally implemented for faster I/O + from files to sockets, but since Linux 2.6.33 it was extended + to work for many more file types. + +config BUSYBOX_CONFIG_FEATURE_COPYBUF_KB + int "Copy buffer size, in kilobytes" + range 1 1024 + default BUSYBOX_DEFAULT_FEATURE_COPYBUF_KB + help + Size of buffer used by cp, mv, install, wget etc. + Buffers which are 4 kb or less will be allocated on stack. + Bigger buffers will be allocated with mmap, with fallback to 4 kb + stack buffer if mmap fails. + +config BUSYBOX_CONFIG_MONOTONIC_SYSCALL + bool "Use clock_gettime(CLOCK_MONOTONIC) syscall" + default BUSYBOX_DEFAULT_MONOTONIC_SYSCALL + help + Use clock_gettime(CLOCK_MONOTONIC) syscall for measuring + time intervals (time, ping, traceroute etc need this). + Probably requires Linux 2.6+. If not selected, gettimeofday + will be used instead (which gives wrong results if date/time + is reset). + +config BUSYBOX_CONFIG_IOCTL_HEX2STR_ERROR + bool "Use ioctl names rather than hex values in error messages" + default BUSYBOX_DEFAULT_IOCTL_HEX2STR_ERROR + help + Use ioctl names rather than hex values in error messages + (e.g. VT_DISALLOCATE rather than 0x5608). If disabled this + saves about 1400 bytes. config BUSYBOX_CONFIG_FEATURE_EDITING bool "Command line editing" @@ -358,96 +399,3 @@ config BUSYBOX_CONFIG_UNICODE_PRESERVE_BROKEN For example, this means that entering 'l', 's', ' ', 0xff, [Enter] at shell prompt will list file named 0xff (single char name with char value 255), not file named '?'. - -config BUSYBOX_CONFIG_FEATURE_NON_POSIX_CP - bool "Non-POSIX, but safer, copying to special nodes" - default BUSYBOX_DEFAULT_FEATURE_NON_POSIX_CP - help - With this option, "cp file symlink" will delete symlink - and create a regular file. This does not conform to POSIX, - but prevents a symlink attack. - Similarly, "cp file device" will not send file's data - to the device. (To do that, use "cat file >device") - -config BUSYBOX_CONFIG_FEATURE_VERBOSE_CP_MESSAGE - bool "Give more precise messages when copy fails (cp, mv etc)" - default BUSYBOX_DEFAULT_FEATURE_VERBOSE_CP_MESSAGE - help - Error messages with this feature enabled: - - $ cp file /does_not_exist/file - cp: cannot create '/does_not_exist/file': Path does not exist - $ cp file /vmlinuz/file - cp: cannot stat '/vmlinuz/file': Path has non-directory component - - If this feature is not enabled, they will be, respectively: - - cp: cannot create '/does_not_exist/file': No such file or directory - cp: cannot stat '/vmlinuz/file': Not a directory - - This will cost you ~60 bytes. - -config BUSYBOX_CONFIG_FEATURE_USE_SENDFILE - bool "Use sendfile system call" - default BUSYBOX_DEFAULT_FEATURE_USE_SENDFILE - help - When enabled, busybox will use the kernel sendfile() function - instead of read/write loops to copy data between file descriptors - (for example, cp command does this a lot). - If sendfile() doesn't work, copying code falls back to read/write - loop. sendfile() was originally implemented for faster I/O - from files to sockets, but since Linux 2.6.33 it was extended - to work for many more file types. - -config BUSYBOX_CONFIG_FEATURE_COPYBUF_KB - int "Copy buffer size, in kilobytes" - range 1 1024 - default BUSYBOX_DEFAULT_FEATURE_COPYBUF_KB - help - Size of buffer used by cp, mv, install, wget etc. - Buffers which are 4 kb or less will be allocated on stack. - Bigger buffers will be allocated with mmap, with fallback to 4 kb - stack buffer if mmap fails. - -config BUSYBOX_CONFIG_FEATURE_SKIP_ROOTFS - bool "Skip rootfs in mount table" - default BUSYBOX_DEFAULT_FEATURE_SKIP_ROOTFS - help - Ignore rootfs entry in mount table. - - In Linux, kernel has a special filesystem, rootfs, which is initially - mounted on /. It contains initramfs data, if kernel is configured - to have one. Usually, another file system is mounted over / early - in boot process, and therefore most tools which manipulate - mount table, such as df, will skip rootfs entry. - - However, some systems do not mount anything on /. - If you need to configure busybox for one of these systems, - you may find it useful to turn this option off to make df show - initramfs statistics. - - Otherwise, choose Y. - -config BUSYBOX_CONFIG_MONOTONIC_SYSCALL - bool "Use clock_gettime(CLOCK_MONOTONIC) syscall" - default BUSYBOX_DEFAULT_MONOTONIC_SYSCALL - help - Use clock_gettime(CLOCK_MONOTONIC) syscall for measuring - time intervals (time, ping, traceroute etc need this). - Probably requires Linux 2.6+. If not selected, gettimeofday - will be used instead (which gives wrong results if date/time - is reset). - -config BUSYBOX_CONFIG_IOCTL_HEX2STR_ERROR - bool "Use ioctl names rather than hex values in error messages" - default BUSYBOX_DEFAULT_IOCTL_HEX2STR_ERROR - help - Use ioctl names rather than hex values in error messages - (e.g. VT_DISALLOCATE rather than 0x5608). If disabled this - saves about 1400 bytes. - -config BUSYBOX_CONFIG_FEATURE_HWIB - bool "Support infiniband HW" - default BUSYBOX_DEFAULT_FEATURE_HWIB - help - Support for printing infiniband addresses in network applets. diff --git a/package/utils/busybox/config/mailutils/Config.in b/package/utils/busybox/config/mailutils/Config.in index a8632471a8..ea7ae6d649 100644 --- a/package/utils/busybox/config/mailutils/Config.in +++ b/package/utils/busybox/config/mailutils/Config.in @@ -1,6 +1,13 @@ # DO NOT EDIT. This file is generated from Config.src menu "Mail Utilities" +config BUSYBOX_CONFIG_FEATURE_MIME_CHARSET + string "Default charset" + default BUSYBOX_DEFAULT_FEATURE_MIME_CHARSET + depends on BUSYBOX_CONFIG_MAKEMIME || BUSYBOX_CONFIG_REFORMIME || BUSYBOX_CONFIG_SENDMAIL + help + Default charset of the message. + config BUSYBOX_CONFIG_MAKEMIME bool "makemime (5.4 kb)" default BUSYBOX_DEFAULT_MAKEMIME @@ -41,11 +48,4 @@ config BUSYBOX_CONFIG_SENDMAIL help Barebones sendmail. -config BUSYBOX_CONFIG_FEATURE_MIME_CHARSET - string "Default charset" - default BUSYBOX_DEFAULT_FEATURE_MIME_CHARSET - depends on BUSYBOX_CONFIG_MAKEMIME || BUSYBOX_CONFIG_REFORMIME || BUSYBOX_CONFIG_SENDMAIL - help - Default charset of the message. - endmenu diff --git a/package/utils/busybox/config/networking/Config.in b/package/utils/busybox/config/networking/Config.in index 79bb6b1f53..861e4f9bbf 100644 --- a/package/utils/busybox/config/networking/Config.in +++ b/package/utils/busybox/config/networking/Config.in @@ -47,6 +47,32 @@ config BUSYBOX_CONFIG_VERBOSE_RESOLUTION_ERRORS "can't resolve 'hostname.com'" and want to know more. This may increase size of your executable a bit. +config BUSYBOX_CONFIG_FEATURE_ETC_NETWORKS + bool "Support /etc/networks" + default BUSYBOX_DEFAULT_FEATURE_ETC_NETWORKS + help + Enable support for network names in /etc/networks. This is + a rarely used feature which allows you to use names + instead of IP/mask pairs in route command. + +config BUSYBOX_CONFIG_FEATURE_ETC_SERVICES + bool "Consult /etc/services even for well-known ports" + default BUSYBOX_DEFAULT_FEATURE_ETC_SERVICES + help + Look up e.g. "telnet" and "http" in /etc/services file + instead of assuming ports 23 and 80. + This is almost never necessary (everybody uses standard ports), + and it makes sense to avoid reading this file. + If you disable this option, in the cases where port is explicitly + specified as a service name (e.g. "telnet HOST PORTNAME"), + it will still be looked up in /etc/services. + +config BUSYBOX_CONFIG_FEATURE_HWIB + bool "Support infiniband HW" + default BUSYBOX_DEFAULT_FEATURE_HWIB + help + Support for printing infiniband addresses in network applets. + config BUSYBOX_CONFIG_FEATURE_TLS_SHA1 bool "In TLS code, support ciphers which use deprecated SHA1" depends on BUSYBOX_CONFIG_TLS @@ -173,6 +199,12 @@ config BUSYBOX_CONFIG_HTTPD help HTTP server. +config BUSYBOX_CONFIG_FEATURE_HTTPD_PORT_DEFAULT + int "Default port" + default BUSYBOX_DEFAULT_FEATURE_HTTPD_PORT_DEFAULT + range 1 65535 + depends on BUSYBOX_CONFIG_HTTPD + config BUSYBOX_CONFIG_FEATURE_HTTPD_RANGES bool "Support 'Ranges:' header" default BUSYBOX_DEFAULT_FEATURE_HTTPD_RANGES @@ -774,7 +806,6 @@ config BUSYBOX_CONFIG_FEATURE_NSLOOKUP_LONG_OPTIONS bool "Enable long options" default BUSYBOX_DEFAULT_FEATURE_NSLOOKUP_LONG_OPTIONS depends on BUSYBOX_CONFIG_FEATURE_NSLOOKUP_BIG && BUSYBOX_CONFIG_LONG_OPTS - config BUSYBOX_CONFIG_NTPD bool "ntpd (22 kb)" default BUSYBOX_DEFAULT_NTPD @@ -945,6 +976,12 @@ config BUSYBOX_CONFIG_FEATURE_TELNETD_STANDALONE help Selecting this will make telnetd able to run standalone. +config BUSYBOX_CONFIG_FEATURE_TELNETD_PORT_DEFAULT + int "Default port" + default BUSYBOX_DEFAULT_FEATURE_TELNETD_PORT_DEFAULT + range 1 65535 + depends on BUSYBOX_CONFIG_FEATURE_TELNETD_STANDALONE + config BUSYBOX_CONFIG_FEATURE_TELNETD_INETD_WAIT bool "Support -w SEC option (inetd wait mode)" default BUSYBOX_DEFAULT_FEATURE_TELNETD_INETD_WAIT diff --git a/package/utils/busybox/config/procps/Config.in b/package/utils/busybox/config/procps/Config.in index e6c3271254..0501daf8fd 100644 --- a/package/utils/busybox/config/procps/Config.in +++ b/package/utils/busybox/config/procps/Config.in @@ -6,6 +6,21 @@ menu "Process Utilities" +config BUSYBOX_CONFIG_FEATURE_FAST_TOP + bool "Faster /proc scanning code (+100 bytes)" + default BUSYBOX_DEFAULT_FEATURE_FAST_TOP # all "fast or small" options default to small + help + This option makes top and ps ~20% faster (or 20% less CPU hungry), + but code size is slightly bigger. + +config BUSYBOX_CONFIG_FEATURE_SHOW_THREADS + bool "Support thread display in ps/pstree/top" + default BUSYBOX_DEFAULT_FEATURE_SHOW_THREADS + depends on BUSYBOX_CONFIG_PS || BUSYBOX_CONFIG_TOP || BUSYBOX_CONFIG_PSTREE + help + Enables the ps -T option, showing of threads in pstree, + and 'h' command in top. + config BUSYBOX_CONFIG_FREE bool "free (3.1 kb)" default BUSYBOX_DEFAULT_FREE @@ -259,12 +274,4 @@ config BUSYBOX_CONFIG_WATCH watch is used to execute a program periodically, showing output to the screen. -config BUSYBOX_CONFIG_FEATURE_SHOW_THREADS - bool "Support thread display in ps/pstree/top" - default BUSYBOX_DEFAULT_FEATURE_SHOW_THREADS - depends on BUSYBOX_CONFIG_PS || BUSYBOX_CONFIG_TOP || BUSYBOX_CONFIG_PSTREE - help - Enables the ps -T option, showing of threads in pstree, - and 'h' command in top. - endmenu diff --git a/package/utils/busybox/patches/301-ip-link-fix-netlink-msg-size.patch b/package/utils/busybox/patches/301-ip-link-fix-netlink-msg-size.patch index f7cd2322c9..f4c0a80922 100644 --- a/package/utils/busybox/patches/301-ip-link-fix-netlink-msg-size.patch +++ b/package/utils/busybox/patches/301-ip-link-fix-netlink-msg-size.patch @@ -1,6 +1,6 @@ --- a/networking/libiproute/iplink.c +++ b/networking/libiproute/iplink.c -@@ -652,7 +652,7 @@ static int do_add_or_delete(char **argv, +@@ -683,7 +683,7 @@ static int do_add_or_delete(char **argv, } xrtnl_open(&rth); ll_init_map(&rth); diff --git a/package/utils/lua/Makefile b/package/utils/lua/Makefile index e15142d8d2..279759e972 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:=9 +PKG_RELEASE:=10 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.lua.org/ftp/ \ @@ -125,7 +125,7 @@ endif define Host/Compile $(MAKE) -C $(HOST_BUILD_DIR) \ - CC="$(HOSTCC) -std=gnu99" \ + CC="$(HOSTCC) $(HOST_FPIC) -std=gnu99" \ $(LUA_OS) endef diff --git a/package/utils/lua5.3/Makefile b/package/utils/lua5.3/Makefile index c9e9bebb1a..19f3b4dfda 100644 --- a/package/utils/lua5.3/Makefile +++ b/package/utils/lua5.3/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=lua PKG_VERSION:=5.3.5 -PKG_RELEASE:=4 +PKG_RELEASE:=5 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.lua.org/ftp/ \ @@ -110,7 +110,7 @@ endif define Host/Compile $(MAKE) -C $(HOST_BUILD_DIR) \ - CC="$(HOSTCC) -std=gnu99" \ + CC="$(HOSTCC) $(HOST_FPIC) -std=gnu99" \ $(LUA_OS) endef diff --git a/package/utils/mdadm/Makefile b/package/utils/mdadm/Makefile index f20a58b704..f6696bf21c 100644 --- a/package/utils/mdadm/Makefile +++ b/package/utils/mdadm/Makefile @@ -52,7 +52,7 @@ TARGET_CFLAGS += \ TARGET_LDFLAGS += -Wl,--gc-sections -MAKE_VARS += CHECK_RUN_DIR=0 +MAKE_FLAGS += CHECK_RUN_DIR=0 define Build/Compile $(call Build/Compile/Default,mdadm) diff --git a/target/linux/apm821xx/patches-5.10/802-usb-xhci-force-msi-renesas-xhci.patch b/target/linux/apm821xx/patches-5.10/802-usb-xhci-force-msi-renesas-xhci.patch index daaf46bc5f..d7376abc80 100644 --- a/target/linux/apm821xx/patches-5.10/802-usb-xhci-force-msi-renesas-xhci.patch +++ b/target/linux/apm821xx/patches-5.10/802-usb-xhci-force-msi-renesas-xhci.patch @@ -13,7 +13,7 @@ produce a noisy warning. --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -276,6 +276,7 @@ static void xhci_pci_quirks(struct devic +@@ -279,6 +279,7 @@ static void xhci_pci_quirks(struct devic pdev->device == 0x0015) { xhci->quirks |= XHCI_RESET_ON_RESUME; xhci->quirks |= XHCI_ZERO_64B_REGS; diff --git a/target/linux/ath79/dts/ar9344_openmesh_om5p-an.dts b/target/linux/ath79/dts/ar9344_openmesh_om5p-an.dts new file mode 100644 index 0000000000..e15e296f82 --- /dev/null +++ b/target/linux/ath79/dts/ar9344_openmesh_om5p-an.dts @@ -0,0 +1,230 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344.dtsi" + +#include +#include + +/ { + compatible = "openmesh,om5p-an", "qca,ar9344"; + model = "OpenMesh OM5P-AN"; + + chosen { + /delete-property/ bootargs; + }; + + aliases { + led-boot = &led_power_blue; + led-failsafe = &led_power_blue; + led-running = &led_power_blue; + led-upgrade = &led_power_blue; + label-mac-device = ð0; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + pinctrl-names = "default"; + pinctrl-0 = <&led_lan_wan_blue_pin>; + + led_power_blue: power_blue { + label = "blue:power"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + wan_blue { + label = "blue:wan"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + + lan_blue { + label = "blue:lan"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + wifi_green { + label = "green:wifi"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + wifi_yellow { + label = "yellow:wifi"; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + }; + + wifi_red { + label = "red:wifi"; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + }; + }; + + i2c { + compatible = "i2c-gpio"; + gpios = <&gpio 21 GPIO_ACTIVE_HIGH /* sda */ + &gpio 20 GPIO_ACTIVE_HIGH /* scl */ + >; + #address-cells = <1>; + #size-cells = <0>; + + i2c-gpio,scl-open-drain; + i2c-gpio,sda-open-drain; + + tmp423a@4c { + compatible = "ti,tmp423"; + reg = <0x4c>; + }; + }; + + watchdog { + compatible = "linux,wdt-gpio"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + hw_algo = "toggle"; + /* hw_margin_ms is actually 300s but driver limits it to 60s */ + hw_margin_ms = <60000>; + always-running; + }; +}; + +&ref { + clock-frequency = <40000000>; +}; + +&pinmux { + led_lan_wan_blue_pin: pinmux_lan_wan_blue_pin { + pinctrl-single,bits = <0xc 0x0 0xffff0000>; + }; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + + /* partitions are passed via bootloader */ + 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 { + label = "custom"; + reg = <0x050000 0x060000>; + read-only; + }; + + partition@b0000 { + label = "inactive"; + reg = <0x0b0000 0x7a0000>; + }; + + partition@850000 { + label = "inactive2"; + reg = <0x850000 0x7a0000>; + }; + + art: partition@ff0000 { + label = "ART"; + reg = <0xff0000 0x010000>; + read-only; + }; + }; + }; +}; + +&mdio0 { + status = "okay"; + + phy-mask = <0x80>; + + phy7: ethernet-phy@7 { + reg = <7>; + eee-broken-100tx; + eee-broken-1000t; + }; +}; + +ð0 { + status = "okay"; + + pll-data = <0x02000000 0x00000101 0x00001313>; + + nvmem-cells = <&macaddr_art_0>; + nvmem-cell-names = "mac-address"; + + phy-mode = "rgmii-id"; + phy-handle = <&phy7>; + + gmac-config { + device = <&gmac>; + rgmii-gmac0 = <1>; + rxd-delay = <2>; + rxdv-delay = <2>; + switch-phy-swap = <1>; + }; +}; + +ð1 { + status = "okay"; + + nvmem-cells = <&macaddr_art_0>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; +}; + +&wmac { + status = "okay"; + + mtd-cal-data = <&art 0x1000>; + nvmem-cells = <&macaddr_art_0>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <2>; +}; + +&pcie { + status = "okay"; + + wifi@0,0 { + compatible = "pci168c,0030"; + reg = <0x0000 0 0 0 0>; + qca,no-eeprom; + nvmem-cells = <&macaddr_art_0>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <16>; + }; +}; + +&art { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_0: macaddr@0 { + reg = <0x0 0x6>; + }; +}; diff --git a/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v1.dts b/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v1.dts new file mode 100644 index 0000000000..de21f0119f --- /dev/null +++ b/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v1.dts @@ -0,0 +1,216 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca955x.dtsi" + +#include +#include + +/ { + compatible = "openmesh,om5p-ac-v1", "qca,qca9558"; + model = "OpenMesh OM5P-AC v1"; + + chosen { + /delete-property/ bootargs; + }; + + aliases { + serial0 = &uart; + led-boot = &led_power_blue; + led-failsafe = &led_power_blue; + led-running = &led_power_blue; + led-upgrade = &led_power_blue; + label-mac-device = ð0; + }; + + leds { + compatible = "gpio-leds"; + + led_power_blue: power_blue { + label = "blue:power"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + wan_blue { + label = "blue:wan"; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + }; + + lan_blue { + label = "blue:lan"; + gpios = <&gpio 20 GPIO_ACTIVE_LOW>; + }; + + wifi_green { + label = "green:wifi"; + gpios = <&gpio 21 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + wifi_yellow { + label = "yellow:wifi"; + gpios = <&gpio 22 GPIO_ACTIVE_LOW>; + }; + + wifi_red { + label = "red:wifi"; + gpios = <&gpio 23 GPIO_ACTIVE_LOW>; + }; + }; + + i2c { + compatible = "i2c-gpio"; + gpios = <&gpio 11 GPIO_ACTIVE_HIGH /* sda */ + &gpio 12 GPIO_ACTIVE_HIGH /* scl */ + >; + #address-cells = <1>; + #size-cells = <0>; + + i2c-gpio,scl-open-drain; + i2c-gpio,sda-open-drain; + + tmp423a@4c { + compatible = "ti,tmp423"; + reg = <0x4c>; + }; + }; + + watchdog { + compatible = "linux,wdt-gpio"; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + hw_algo = "toggle"; + /* hw_margin_ms is actually 300s but driver limits it to 60s */ + hw_margin_ms = <60000>; + always-running; + }; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + + /* partitions are passed via bootloader */ + 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 { + label = "custom"; + reg = <0x050000 0x060000>; + read-only; + }; + + partition@b0000 { + label = "inactive"; + reg = <0x0b0000 0x7a0000>; + }; + + partition@850000 { + label = "inactive2"; + reg = <0x850000 0x7a0000>; + }; + + art: partition@ff0000 { + label = "ART"; + reg = <0xff0000 0x010000>; + read-only; + }; + }; + }; +}; + +&mdio0 { + status = "okay"; + + phy-mask = <0x6>; + + phy1: ethernet-phy@1 { + reg = <1>; + eee-broken-100tx; + eee-broken-1000t; + }; + + phy2: ethernet-phy@2 { + reg = <2>; + eee-broken-100tx; + eee-broken-1000t; + at803x-override-sgmii-link-check; + }; +}; + +ð0 { + status = "okay"; + + pll-data = <0x82000101 0x80000101 0x80001313>; + + nvmem-cells = <&macaddr_art_0>; + nvmem-cell-names = "mac-address"; + + phy-mode = "rgmii-id"; + phy-handle = <&phy1>; + + gmac-config { + device = <&gmac>; + rgmii-enabled = <1>; + rxd-delay = <3>; + rxdv-delay = <3>; + txd-delay = <0>; + txen-delay = <0>; + }; +}; + +ð1 { + status = "okay"; + + pll-data = <0x03000101 0x80000101 0x80001313>; + + nvmem-cells = <&macaddr_art_6>; + nvmem-cell-names = "mac-address"; + + qca955x-sgmii-fixup; + + phy-handle = <&phy2>; +}; + +&wmac { + status = "okay"; + + mtd-cal-data = <&art 0x1000>; + nvmem-cells = <&macaddr_art_0>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <2>; +}; + +&pcie1 { + status = "okay"; +}; + +&art { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_0: macaddr@0 { + reg = <0x0 0x6>; + }; + + macaddr_art_6: macaddr@6 { + reg = <0x6 0x6>; + }; +}; diff --git a/target/linux/ath79/dts/qca9563_asus_rp-ac66.dts b/target/linux/ath79/dts/qca9563_asus_rp-ac66.dts new file mode 100644 index 0000000000..b1317d55ec --- /dev/null +++ b/target/linux/ath79/dts/qca9563_asus_rp-ac66.dts @@ -0,0 +1,158 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca956x.dtsi" + +#include +#include +#include + +/ { + model = "ASUS RP-AC66"; + compatible = "asus,rp-ac66", "qca,qca9563"; + + aliases { + led-boot = &led_orange; + led-failsafe = &led_orange; + led-running = &led_power; + led-upgrade = &led_orange; + }; + + leds { + compatible = "gpio-leds"; + + led_power: power { + label = "green:power"; + gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; + }; + + led_orange: wps { + label = "orange:wps"; + gpios = <&gpio 1 GPIO_ACTIVE_HIGH>; + }; + + rssilow-wlan0 { + label = "blue:rssilow-wlan0"; + gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; + }; + + rssimedium-wlan0 { + label = "red:rssimedium-wlan0"; + gpios = <&gpio 16 GPIO_ACTIVE_HIGH>; + }; + + rssihigh-wlan0 { + label = "green:rssihigh-wlan0"; + gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; + }; + + rssilow-wlan1 { + label = "blue:rssilow-wlan1"; + gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; + }; + + rssimedium-wlan1 { + label = "red:rssimedium-wlan1"; + gpios = <&gpio 9 GPIO_ACTIVE_HIGH>; + }; + + rssihigh-wlan1 { + label = "green:rssihigh-wlan1"; + gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; + }; + }; + + keys { + compatible = "gpio-keys"; + + wps { + linux,code = ; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + reset { + linux,code = ; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x000000 0x40000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x040000 0x10000>; + read-only; + }; + + art: partition@50000 { + label = "art"; + reg = <0x050000 0x10000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_1002: macaddr@1002 { + reg = <0x1002 0x6>; + }; + }; + + partition@60000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x060000 0xf20000>; + }; + }; + }; +}; + +&mdio0 { + status = "okay"; + + phy-mask = <0>; + + phy0: ethernet-phy@3 { + reg = <0x3>; + phy-mode = "sgmii"; + qca,mib-poll-interval = <500>; + }; +}; + +ð0 { + status = "okay"; + + phy-mode = "sgmii"; + nvmem-cells = <&macaddr_art_1002>; + nvmem-cell-names = "mac-address"; + phy-handle = <&phy0>; +}; + +&wmac { + status = "okay"; + + qca,no-eeprom; +}; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds index 7ddb9a1881..8e38b24eb1 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds @@ -48,6 +48,16 @@ alfa-network,r36a) ucidef_set_led_netdev "lan" "LAN" "blue:lan" "eth0" ucidef_set_led_switch "wan" "WAN" "blue:wan" "switch0" "0x10" ;; +asus,rp-ac66) + ucidef_set_rssimon "wlan0" "200000" "1" + ucidef_set_rssimon "wlan1" "200000" "1" + ucidef_set_led_rssi "rssilow-wlan0" "RSSILOW" "blue:rssilow-wlan0" "wlan0" "1" "1" + ucidef_set_led_rssi "rssimedium-wlan0" "RSSIMEDIUM" "red:rssimedium-wlan0" "wlan0" "1" "79" + ucidef_set_led_rssi "rssihigh-wlan0" "RSSIHIGH" "green:rssihigh-wlan0" "wlan0" "70" "100" + ucidef_set_led_rssi "rssilow-wlan1" "RSSILOW" "blue:rssilow-wlan1" "wlan1" "1" "1" + ucidef_set_led_rssi "rssimedium-wlan1" "RSSIMEDIUM" "red:rssimedium-wlan1" "wlan1" "1" "79" + ucidef_set_led_rssi "rssihigh-wlan1" "RSSIHIGH" "green:rssihigh-wlan1" "wlan1" "70" "100" + ;; avm,fritz1750e) ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth0" ucidef_set_rssimon "wlan1" "200000" "1" @@ -261,6 +271,14 @@ openmesh,om2p-hs-v4) ucidef_set_led_netdev "wan" "WAN" "blue:wan" "eth0" ucidef_set_led_switch "lan" "LAN" "blue:lan" "switch0" "0x02" ;; +openmesh,om5p-ac-v1) + ucidef_set_led_netdev "lan" "LAN" "blue:lan" "eth0" + ucidef_set_led_netdev "wan" "WAN" "blue:wan" "eth1" + ;; +openmesh,om5p-an) + ucidef_set_led_netdev "lan" "LAN" "blue:lan" "eth0" + ucidef_set_led_switch "wan" "WAN" "blue:wan" "switch0" "0x02" + ;; pcs,cr3000) ucidef_set_led_netdev "wan" "WAN" "blue:wan" "eth1" ucidef_set_led_switch "lan1" "LAN1" "blue:lan1" "switch0" "0x04" diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 1f552785ec..ff4c13d8fd 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -15,6 +15,7 @@ ath79_setup_interfaces() alfa-network,pi-wifi4|\ arduino,yun|\ aruba,ap-105|\ + asus,rp-ac66|\ avm,fritz1750e|\ avm,fritz300e|\ avm,fritzdvbc|\ @@ -534,6 +535,10 @@ ath79_setup_macs() lan_mac=$(macaddr_setbit $base_mac 29) [ $lan_mac = $base_mac ] && lan_mac=$(macaddr_unsetbit $base_mac 29) ;; + asus,rp-ac66) + lan_mac=$(mtd_get_mac_binary art 0x1002) + label_mac=$lan_mac + ;; avm,fritz1750e|\ avm,fritz450e|\ avm,fritzdvbc) diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index 219e618cb9..10421c2e28 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -12,6 +12,9 @@ case "$FIRMWARE" in 8dev,lima) caldata_extract "art" 0x1000 0x800 ;; + asus,rp-ac66) + caldata_extract "art" 0x1000 0x440 + ;; avm,fritz1750e|\ avm,fritz4020|\ avm,fritz450e|\ @@ -124,7 +127,8 @@ case "$FIRMWARE" in caldata_extract "art" 0x1000 0x1000 ;; openmesh,mr600-v1|\ - openmesh,mr600-v2) + openmesh,mr600-v2|\ + openmesh,om5p-an) caldata_extract "ART" 0x5000 0x440 ;; wd,mynet-n600|\ diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 640e7e0c70..270d4c07d8 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -21,6 +21,7 @@ case "$FIRMWARE" in avm,fritzdvbc) caldata_extract "urlader" 0x198a 0x844 ;; + asus,rp-ac66|\ comfast,cf-wr650ac-v1|\ comfast,cf-wr650ac-v2|\ devolo,dlan-pro-1200plus-ac|\ @@ -164,6 +165,10 @@ case "$FIRMWARE" in ;; "ath10k/cal-pci-0000:01:00.0.bin") case $board in + openmesh,om5p-ac-v1) + caldata_extract "ART" 0x5000 0x844 + ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16) + ;; sitecom,wlr-8100) caldata_extract "art" 0x5000 0x844 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) 1) diff --git a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh index 20041e4c95..3d953d7982 100644 --- a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh @@ -80,7 +80,9 @@ platform_do_upgrade() { openmesh,om2p-hs-v3|\ openmesh,om2p-hs-v4|\ openmesh,om2p-lc|\ - openmesh,om5p) + openmesh,om5p|\ + openmesh,om5p-ac-v1|\ + openmesh,om5p-an) PART_NAME="inactive" platform_do_upgrade_openmesh "$1" ;; diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 2613861c1c..b73b88ceb8 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -357,6 +357,18 @@ define Device/aruba_ap-105 endef TARGET_DEVICES += aruba_ap-105 +define Device/asus_rp-ac66 + SOC := qca9563 + DEVICE_VENDOR := ASUS + DEVICE_MODEL := RP-AC66 + IMAGES += factory.bin + IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \ + append-rootfs | pad-rootfs + DEVICE_PACKAGES := kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct \ + rssileds -swconfig +endef +TARGET_DEVICES += asus_rp-ac66 + define Device/atheros_db120 $(Device/loader-okli-uimage) SOC := ar9344 @@ -1937,6 +1949,17 @@ define Device/openmesh_om5p endef TARGET_DEVICES += openmesh_om5p +define Device/openmesh_om5p-ac-v1 + $(Device/openmesh_common_64k) + SOC := qca9558 + DEVICE_MODEL := OM5P-AC + DEVICE_VARIANT := v1 + DEVICE_PACKAGES += kmod-ath10k-ct ath10k-firmware-qca988x-ct + OPENMESH_CE_TYPE := OM5PAC + SUPPORTED_DEVICES += om5p-ac +endef +TARGET_DEVICES += openmesh_om5p-ac-v1 + define Device/openmesh_om5p-ac-v2 SOC := qca9558 DEVICE_VENDOR := OpenMesh @@ -1949,6 +1972,15 @@ define Device/openmesh_om5p-ac-v2 endef TARGET_DEVICES += openmesh_om5p-ac-v2 +define Device/openmesh_om5p-an + $(Device/openmesh_common_64k) + SOC := ar9344 + DEVICE_MODEL := OM5P-AN + OPENMESH_CE_TYPE := OM5P + SUPPORTED_DEVICES += om5p-an +endef +TARGET_DEVICES += openmesh_om5p-an + define Device/pcs_cap324 SOC := ar9344 DEVICE_VENDOR := PowerCloud Systems diff --git a/target/linux/bcm27xx/patches-5.10/950-0355-xhci-quirks-add-link-TRB-quirk-for-VL805.patch b/target/linux/bcm27xx/patches-5.10/950-0355-xhci-quirks-add-link-TRB-quirk-for-VL805.patch index 92a35bec92..1d2aca4e06 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0355-xhci-quirks-add-link-TRB-quirk-for-VL805.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0355-xhci-quirks-add-link-TRB-quirk-for-VL805.patch @@ -22,7 +22,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -288,6 +288,7 @@ static void xhci_pci_quirks(struct devic +@@ -291,6 +291,7 @@ static void xhci_pci_quirks(struct devic if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483) { xhci->quirks |= XHCI_LPM_SUPPORT; xhci->quirks |= XHCI_EP_CTX_BROKEN_DCS; diff --git a/target/linux/generic/backport-5.10/732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch b/target/linux/generic/backport-5.10/732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch index 696892786e..65619e0837 100644 --- a/target/linux/generic/backport-5.10/732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch +++ b/target/linux/generic/backport-5.10/732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch @@ -319,7 +319,7 @@ Signed-off-by: David S. Miller int tx_size, err, i; struct ag71xx *ag; -@@ -1957,10 +1956,8 @@ static int ag71xx_probe(struct platform_ +@@ -1952,10 +1951,8 @@ static int ag71xx_probe(struct platform_ ag->stop_desc->ctrl = 0; ag->stop_desc->next = (u32)ag->stop_desc_dma; diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10 index cfcf6ec657..f9e14d94e7 100644 --- a/target/linux/generic/config-5.10 +++ b/target/linux/generic/config-5.10 @@ -705,6 +705,7 @@ CONFIG_BPF_JIT_DEFAULT_ON=y # CONFIG_BPF_PRELOAD is not set # CONFIG_BPF_STREAM_PARSER is not set CONFIG_BPF_SYSCALL=y +CONFIG_BPF_UNPRIV_DEFAULT_OFF=y # CONFIG_BPQETHER is not set CONFIG_BQL=y CONFIG_BRANCH_PROFILE_NONE=y diff --git a/target/linux/generic/files/block/partitions/fit.c b/target/linux/generic/files/block/partitions/fit.c index a0aa0eadf5..fa73e64af8 100644 --- a/target/linux/generic/files/block/partitions/fit.c +++ b/target/linux/generic/files/block/partitions/fit.c @@ -230,7 +230,7 @@ int parse_fit_partitions(struct parsed_partitions *state, u64 fit_start_sector, strlcat(state->pp_buf, tmp, PAGE_SIZE); state->parts[*slot].has_info = true; - + state->parts[*slot].flags |= ADDPART_FLAG_READONLY; if (config_loadables && !strcmp(image_name, config_loadables)) { printk(KERN_DEBUG "FIT: selecting configured loadable \"%s\" to be root filesystem\n", image_name); state->parts[*slot].flags |= ADDPART_FLAG_ROOTDEV; diff --git a/target/linux/generic/hack-5.10/204-module_strip.patch b/target/linux/generic/hack-5.10/204-module_strip.patch index f372687ba1..645074821f 100644 --- a/target/linux/generic/hack-5.10/204-module_strip.patch +++ b/target/linux/generic/hack-5.10/204-module_strip.patch @@ -88,7 +88,7 @@ Signed-off-by: Felix Fietkau --- a/init/Kconfig +++ b/init/Kconfig -@@ -2337,6 +2337,13 @@ config UNUSED_KSYMS_WHITELIST +@@ -2347,6 +2347,13 @@ config UNUSED_KSYMS_WHITELIST one per line. The path can be absolute, or relative to the kernel source tree. diff --git a/target/linux/generic/hack-5.10/410-block-fit-partition-parser.patch b/target/linux/generic/hack-5.10/410-block-fit-partition-parser.patch index c0b3c25339..bc48296d9c 100644 --- a/target/linux/generic/hack-5.10/410-block-fit-partition-parser.patch +++ b/target/linux/generic/hack-5.10/410-block-fit-partition-parser.patch @@ -1,10 +1,11 @@ --- a/block/blk.h +++ b/block/blk.h -@@ -361,6 +361,7 @@ char *disk_name(struct gendisk *hd, int +@@ -361,6 +361,8 @@ char *disk_name(struct gendisk *hd, int #define ADDPART_FLAG_NONE 0 #define ADDPART_FLAG_RAID 1 #define ADDPART_FLAG_WHOLEDISK 2 -+#define ADDPART_FLAG_ROOTDEV 4 ++#define ADDPART_FLAG_READONLY 4 ++#define ADDPART_FLAG_ROOTDEV 8 void delete_partition(struct hd_struct *part); int bdev_add_partition(struct block_device *bdev, int partno, sector_t start, sector_t length); @@ -73,13 +74,16 @@ #ifdef CONFIG_SGI_PARTITION sgi_partition, #endif -@@ -694,6 +701,11 @@ static bool blk_add_partition(struct gen +@@ -694,6 +701,14 @@ static bool blk_add_partition(struct gen (state->parts[p].flags & ADDPART_FLAG_RAID)) md_autodetect_dev(part_to_dev(part)->devt); +#ifdef CONFIG_FIT_PARTITION + if ((state->parts[p].flags & ADDPART_FLAG_ROOTDEV) && ROOT_DEV == 0) + ROOT_DEV = part_to_dev(part)->devt; ++ ++ if (state->parts[p].flags & ADDPART_FLAG_READONLY) ++ part->policy = true; +#endif + return true; diff --git a/target/linux/generic/hack-5.10/721-net-phy-aquantia-enable-AQR112-and-AQR412.patch b/target/linux/generic/hack-5.10/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch similarity index 90% rename from target/linux/generic/hack-5.10/721-net-phy-aquantia-enable-AQR112-and-AQR412.patch rename to target/linux/generic/hack-5.10/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch index 882f20c6d1..e3541400d7 100644 --- a/target/linux/generic/hack-5.10/721-net-phy-aquantia-enable-AQR112-and-AQR412.patch +++ b/target/linux/generic/hack-5.10/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch @@ -109,30 +109,38 @@ Signed-off-by: Alex Marginean static int aqr_config_intr(struct phy_device *phydev) { bool en = phydev->interrupts == PHY_INTERRUPT_ENABLED; -@@ -738,6 +808,22 @@ static struct phy_driver aqr_driver[] = +@@ -738,6 +808,30 @@ static struct phy_driver aqr_driver[] = .get_stats = aqr107_get_stats, .link_change_notify = aqr107_link_change_notify, }, +{ + PHY_ID_MATCH_MODEL(PHY_ID_AQR112), + .name = "Aquantia AQR112", -+ .config_aneg = aqr_config_aneg_set_prot, ++ .probe = aqr107_probe, ++ .config_aneg = aqr_config_aneg_set_prot, + .config_intr = aqr_config_intr, + .ack_interrupt = aqr_ack_interrupt, + .read_status = aqr107_read_status, ++ .get_sset_count = aqr107_get_sset_count, ++ .get_strings = aqr107_get_strings, ++ .get_stats = aqr107_get_stats, +}, +{ + PHY_ID_MATCH_MODEL(PHY_ID_AQR412), + .name = "Aquantia AQR412", -+ .config_aneg = aqr_config_aneg_set_prot, ++ .probe = aqr107_probe, ++ .config_aneg = aqr_config_aneg_set_prot, + .config_intr = aqr_config_intr, + .ack_interrupt = aqr_ack_interrupt, + .read_status = aqr107_read_status, ++ .get_sset_count = aqr107_get_sset_count, ++ .get_strings = aqr107_get_strings, ++ .get_stats = aqr107_get_stats, +}, }; module_phy_driver(aqr_driver); -@@ -748,9 +834,11 @@ static struct mdio_device_id __maybe_unu +@@ -748,9 +842,11 @@ static struct mdio_device_id __maybe_unu { PHY_ID_MATCH_MODEL(PHY_ID_AQR105) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR106) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR107) }, diff --git a/target/linux/generic/hack-5.10/723-net-phy-aquantia-fix-system-side-protocol-mi.patch b/target/linux/generic/hack-5.10/723-net-phy-aquantia-fix-system-side-protocol-mi.patch new file mode 100644 index 0000000000..9c5df905bb --- /dev/null +++ b/target/linux/generic/hack-5.10/723-net-phy-aquantia-fix-system-side-protocol-mi.patch @@ -0,0 +1,34 @@ +From 5f008cb22f60da4e10375f22266c1a4e20b1252e Mon Sep 17 00:00:00 2001 +From: Alex Marginean +Date: Fri, 20 Sep 2019 18:22:52 +0300 +Subject: [PATCH] drivers: net: phy: aquantia: fix system side protocol + misconfiguration + +Do not set up protocols for speeds that are not supported by FW. Enabling +these protocols leads to link issues on system side. + +Signed-off-by: Alex Marginean +--- + drivers/net/phy/aquantia_main.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/drivers/net/phy/aquantia_main.c ++++ b/drivers/net/phy/aquantia_main.c +@@ -301,10 +301,16 @@ static int aqr_config_aneg_set_prot(stru + phy_write_mmd(phydev, MDIO_MMD_VEND1, AQUANTIA_VND1_GSTART_RATE, + aquantia_syscfg[if_type].start_rate); + +- for (i = 0; i <= aquantia_syscfg[if_type].cnt; i++) ++ for (i = 0; i <= aquantia_syscfg[if_type].cnt; i++) { ++ u16 reg = phy_read_mmd(phydev, MDIO_MMD_VEND1, ++ AQUANTIA_VND1_GSYSCFG_BASE + i); ++ if (!reg) ++ continue; ++ + phy_write_mmd(phydev, MDIO_MMD_VEND1, + AQUANTIA_VND1_GSYSCFG_BASE + i, + aquantia_syscfg[if_type].syscfg); ++ } + + /* wake PHY back up */ + phy_write_mmd(phydev, MDIO_MMD_VEND1, AQUANTIA_VND1_GLOBAL_SC, 0); diff --git a/target/linux/generic/hack-5.10/722-net-phy-aquantia-Add-AQR113-driver-support.patch b/target/linux/generic/hack-5.10/724-net-phy-aquantia-Add-AQR113-driver-support.patch similarity index 86% rename from target/linux/generic/hack-5.10/722-net-phy-aquantia-Add-AQR113-driver-support.patch rename to target/linux/generic/hack-5.10/724-net-phy-aquantia-Add-AQR113-driver-support.patch index 2b7a38d1c7..7a661309f9 100644 --- a/target/linux/generic/hack-5.10/722-net-phy-aquantia-Add-AQR113-driver-support.patch +++ b/target/linux/generic/hack-5.10/724-net-phy-aquantia-Add-AQR113-driver-support.patch @@ -18,8 +18,8 @@ Add a new entry for AQR113 PHY_ID #define PHY_ID_AQR113C 0x31c31c12 #define PHY_ID_AQCS109 0x03a1b5c2 #define PHY_ID_AQR405 0x03a1b4b0 -@@ -817,6 +818,14 @@ static struct phy_driver aqr_driver[] = - .read_status = aqr107_read_status, +@@ -827,6 +828,14 @@ static struct phy_driver aqr_driver[] = + .get_stats = aqr107_get_stats, }, { + PHY_ID_MATCH_MODEL(PHY_ID_AQR113), @@ -32,8 +32,8 @@ Add a new entry for AQR113 PHY_ID +{ PHY_ID_MATCH_MODEL(PHY_ID_AQR412), .name = "Aquantia AQR412", - .config_aneg = aqr_config_aneg_set_prot, -@@ -835,6 +844,7 @@ static struct mdio_device_id __maybe_unu + .probe = aqr107_probe, +@@ -849,6 +858,7 @@ static struct mdio_device_id __maybe_unu { PHY_ID_MATCH_MODEL(PHY_ID_AQR106) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR107) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR112) }, diff --git a/target/linux/generic/hack-5.10/723-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch b/target/linux/generic/hack-5.10/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch similarity index 79% rename from target/linux/generic/hack-5.10/723-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch rename to target/linux/generic/hack-5.10/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch index b60d009241..40ad0ff583 100644 --- a/target/linux/generic/hack-5.10/723-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch +++ b/target/linux/generic/hack-5.10/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch @@ -21,30 +21,38 @@ Signed-off-by: Daniel Golle #define PHY_ID_AQR113 0x31c31c40 #define PHY_ID_AQR113C 0x31c31c12 #define PHY_ID_AQCS109 0x03a1b5c2 -@@ -818,6 +820,22 @@ static struct phy_driver aqr_driver[] = - .read_status = aqr107_read_status, +@@ -828,6 +830,30 @@ static struct phy_driver aqr_driver[] = + .get_stats = aqr107_get_stats, }, { + PHY_ID_MATCH_MODEL(PHY_ID_AQR112C), + .name = "Aquantia AQR112C", ++ .probe = aqr107_probe, + .config_aneg = aqr_config_aneg_set_prot, + .config_intr = aqr_config_intr, + .ack_interrupt = aqr_ack_interrupt, + .read_status = aqr107_read_status, ++ .get_sset_count = aqr107_get_sset_count, ++ .get_strings = aqr107_get_strings, ++ .get_stats = aqr107_get_stats, +}, +{ + PHY_ID_MATCH_MODEL(PHY_ID_AQR112R), + .name = "Aquantia AQR112R", ++ .probe = aqr107_probe, + .config_aneg = aqr_config_aneg_set_prot, + .config_intr = aqr_config_intr, + .ack_interrupt = aqr_ack_interrupt, + .read_status = aqr107_read_status, ++ .get_sset_count = aqr107_get_sset_count, ++ .get_strings = aqr107_get_strings, ++ .get_stats = aqr107_get_stats, +}, +{ PHY_ID_MATCH_MODEL(PHY_ID_AQR113), .name = "Aquantia AQR113", .config_aneg = aqr_config_aneg, -@@ -844,6 +862,8 @@ static struct mdio_device_id __maybe_unu +@@ -858,6 +884,8 @@ static struct mdio_device_id __maybe_unu { PHY_ID_MATCH_MODEL(PHY_ID_AQR106) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR107) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR112) }, diff --git a/target/linux/generic/pending-5.10/920-mangle_bootargs.patch b/target/linux/generic/pending-5.10/920-mangle_bootargs.patch index d8f5c06b7e..fc64a4205e 100644 --- a/target/linux/generic/pending-5.10/920-mangle_bootargs.patch +++ b/target/linux/generic/pending-5.10/920-mangle_bootargs.patch @@ -13,7 +13,7 @@ Signed-off-by: Imre Kaloz --- a/init/Kconfig +++ b/init/Kconfig -@@ -1790,6 +1790,15 @@ config EMBEDDED +@@ -1800,6 +1800,15 @@ config EMBEDDED an embedded system so certain expert options are available for configuration. diff --git a/target/linux/ipq806x/image/Makefile b/target/linux/ipq806x/image/Makefile index 723b9b7ef2..f4f829b35c 100644 --- a/target/linux/ipq806x/image/Makefile +++ b/target/linux/ipq806x/image/Makefile @@ -3,26 +3,6 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/image.mk -DEVICE_VARS += NETGEAR_BOARD_ID NETGEAR_HW_ID -DEVICE_VARS += TPLINK_BOARD_ID - -define Build/buffalo-rootfs-cksum - ( \ - echo -ne "\x$$(od -A n -t u1 $@ | tr -s ' ' '\n' | \ - $(STAGING_DIR_HOST)/bin/awk '{s+=$$0}END{printf "%x", 255-s%256}')"; \ - ) >> $@ -endef - -define Build/edimax-header - $(eval edimax_model=$(word 1,$(1))) - - $(STAGING_DIR_HOST)/bin/mkedimaximg \ - -b -s CSYS -m $(edimax_model) \ - -f 0x70000 -S 0x1200000 \ - -i $@ -o $@.new - @mv $@.new $@ -endef - define Device/Default PROFILES := Default KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts) @@ -59,418 +39,6 @@ define Device/UbiFit IMAGE/nand-sysupgrade.bin := sysupgrade-tar | append-metadata endef -define Device/DniImage - KERNEL_SUFFIX := -uImage - KERNEL = kernel-bin | append-dtb | uImage none - KERNEL_NAME := zImage - NETGEAR_BOARD_ID := - NETGEAR_HW_ID := - UBINIZE_OPTS := -E 5 - IMAGES += factory.img - IMAGE/factory.img := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-uImage-fakehdr filesystem | pad-to $$$$(KERNEL_SIZE) | append-ubi | netgear-dni - IMAGE/sysupgrade.bin := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-uImage-fakehdr filesystem | sysupgrade-tar kernel=$$$$@ | append-metadata -endef - -define Device/TpSafeImage - KERNEL_SUFFIX := -uImage - KERNEL = kernel-bin | append-dtb | uImage none - KERNEL_NAME := zImage - TPLINK_BOARD_ID := - IMAGES += factory.bin - IMAGE/factory.bin := append-rootfs | tplink-safeloader factory - IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | append-metadata -endef - -define Device/ZyXELImage - KERNEL_SUFFIX := -uImage - KERNEL = kernel-bin | append-dtb | uImage none | pad-to $$(KERNEL_SIZE) - KERNEL_NAME := zImage - IMAGES += factory.bin - IMAGE/factory.bin := append-rootfs | pad-rootfs | pad-to $$$$(BLOCKSIZE) | zyxel-ras-image separate-kernel - IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-to $$$$(BLOCKSIZE) | sysupgrade-tar rootfs=$$$$@ | append-metadata -endef - -define Device/askey_rt4230w-rev6 - $(call Device/LegacyImage) - DEVICE_VENDOR := Askey - DEVICE_MODEL := RT4230W - DEVICE_VARIANT := REV6 - SOC := qcom-ipq8065 - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_IN_UBI := 1 - DEVICE_PACKAGES := ath10k-firmware-qca9984-ct -endef -TARGET_DEVICES += askey_rt4230w-rev6 - -define Device/asrock_g10 - $(call Device/FitImage) - $(call Device/UbiFit) - SOC := qcom-ipq8064 - DEVICE_VENDOR := ASRock - DEVICE_MODEL := G10 - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_SIZE := 5332k - DEVICE_PACKAGES := kmod-i2c-gpio ath10k-firmware-qca99x0-ct - IMAGE/nand-factory.bin := append-ubi | edimax-header RN67 -endef -TARGET_DEVICES += asrock_g10 - -define Device/buffalo_wxr-2533dhp - $(call Device/LegacyImage) - SOC := qcom-ipq8064 - DEVICE_VENDOR := Buffalo - DEVICE_MODEL := WXR-2533DHP - BLOCKSIZE := 128k - PAGESIZE := 2048 - IMAGE_SIZE := 65536k - KERNEL_IN_UBI := 1 - IMAGE/sysupgrade.bin := append-rootfs | buffalo-rootfs-cksum | \ - sysupgrade-tar rootfs=$$$$@ | append-metadata - DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct -endef -TARGET_DEVICES += buffalo_wxr-2533dhp - -define Device/compex_wpq864 - $(call Device/FitImage) - $(call Device/UbiFit) - DEVICE_VENDOR := Compex - DEVICE_MODEL := WPQ864 - BLOCKSIZE := 128k - PAGESIZE := 2048 - SOC := qcom-ipq8064 - DEVICE_PACKAGES := kmod-gpio-beeper -endef -TARGET_DEVICES += compex_wpq864 - -define Device/edgecore_ecw5410 - $(call Device/FitImage) - $(call Device/UbiFit) - DEVICE_VENDOR := Edgecore - DEVICE_MODEL := ECW5410 - SOC := qcom-ipq8068 - BLOCKSIZE := 128k - PAGESIZE := 2048 - DEVICE_DTS_CONFIG := config@v2.0-ap160 - DEVICE_PACKAGES := ath10k-firmware-qca9984-ct ipq-wifi-edgecore_ecw5410 -endef -TARGET_DEVICES += edgecore_ecw5410 - -define Device/linksys_ea7500-v1 - $(call Device/LegacyImage) - DEVICE_VENDOR := Linksys - DEVICE_MODEL := EA7500 - DEVICE_VARIANT := v1 - SOC := qcom-ipq8064 - PAGESIZE := 2048 - BLOCKSIZE := 128k - KERNEL_SIZE := 3072k - KERNEL = kernel-bin | append-dtb | uImage none | append-uImage-fakehdr filesystem - UBINIZE_OPTS := -E 5 - IMAGES := factory.bin sysupgrade.bin - IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | pad-to $$$$(PAGESIZE) - DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct - DEFAULT := n -endef -TARGET_DEVICES += linksys_ea7500-v1 - -define Device/linksys_ea8500 - $(call Device/LegacyImage) - DEVICE_VENDOR := Linksys - DEVICE_MODEL := EA8500 - SOC := qcom-ipq8064 - PAGESIZE := 2048 - BLOCKSIZE := 128k - KERNEL_SIZE := 3072k - KERNEL = kernel-bin | append-dtb | uImage none | append-uImage-fakehdr filesystem - BOARD_NAME := ea8500 - SUPPORTED_DEVICES += ea8500 - UBINIZE_OPTS := -E 5 - IMAGES += factory.bin - IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi - DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct - DEFAULT := n -endef -TARGET_DEVICES += linksys_ea8500 - -define Device/meraki_mr42 - $(call Device/FitImage) - DEVICE_VENDOR := Cisco Meraki - DEVICE_MODEL := MR42 - SOC := qcom-ipq8068 - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_LOADADDR = 0x44208000 - DEVICE_PACKAGES := -swconfig -kmod-ata-ahci -kmod-ata-ahci-platform \ - -kmod-usb-ohci -kmod-usb2 -kmod-usb-ledtrig-usbport \ - -kmod-phy-qcom-ipq806x-usb -kmod-usb3 -kmod-usb-dwc3-qcom \ - -uboot-envtools ath10k-firmware-qca9887-ct \ - ath10k-firmware-qca99x0-ct kmod-eeprom-at24 kmod-hwmon-ina2xx \ - kmod-leds-tlc591xx -endef -TARGET_DEVICES += meraki_mr42 - -define Device/meraki_mr52 - $(call Device/FitImage) - DEVICE_VENDOR := Cisco Meraki - DEVICE_MODEL := MR52 - SOC := qcom-ipq8068 - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_LOADADDR = 0x44208000 - DEVICE_DTS_CONFIG := config@2 - DEVICE_PACKAGES := -swconfig -kmod-ata-ahci -kmod-ata-ahci-platform \ - -kmod-usb-ohci -kmod-usb2 -kmod-usb-ledtrig-usbport \ - -kmod-phy-qcom-ipq806x-usb -kmod-usb3 -kmod-usb-dwc3-qcom \ - -uboot-envtools ath10k-firmware-qca9887-ct \ - ath10k-firmware-qca9984-ct kmod-eeprom-at24 kmod-hwmon-ina2xx \ - kmod-leds-tlc591xx -endef -TARGET_DEVICES += meraki_mr52 - -define Device/nec_wg2600hp - $(call Device/LegacyImage) - DEVICE_VENDOR := NEC - DEVICE_MODEL := Aterm WG2600HP - SOC := qcom-ipq8064 - BLOCKSIZE := 64k - BOARD_NAME := wg2600hp - IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata - DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct -endef -TARGET_DEVICES += nec_wg2600hp - -define Device/nec_wg2600hp3 - $(call Device/LegacyImage) - DEVICE_VENDOR := NEC Platforms - DEVICE_MODEL := Aterm WG2600HP3 - SOC := qcom-ipq8062 - BLOCKSIZE := 64k - IMAGES := sysupgrade.bin - IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata - DEVICE_PACKAGES := -kmod-ata-ahci -kmod-ata-ahci-platform -kmod-usb-ohci -kmod-usb2 \ - -kmod-usb-ledtrig-usbport -kmod-usb-phy-qcom-dwc3 -kmod-usb3 -kmod-usb-dwc3-qcom \ - ath10k-firmware-qca9984-ct ipq-wifi-nec_wg2600hp3 -endef -TARGET_DEVICES += nec_wg2600hp3 - -define Device/netgear_d7800 - $(call Device/DniImage) - DEVICE_VENDOR := NETGEAR - DEVICE_MODEL := Nighthawk X4 D7800 - SOC := qcom-ipq8064 - KERNEL_SIZE := 4096k - NETGEAR_BOARD_ID := D7800 - NETGEAR_HW_ID := 29764958+0+128+512+4x4+4x4 - BLOCKSIZE := 128k - PAGESIZE := 2048 - BOARD_NAME := d7800 - SUPPORTED_DEVICES += d7800 - DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct -endef -TARGET_DEVICES += netgear_d7800 - -define Device/netgear_r7500 - $(call Device/DniImage) - DEVICE_VENDOR := NETGEAR - DEVICE_MODEL := Nighthawk X4 R7500 - DEVICE_VARIANT := v1 - SOC := qcom-ipq8064 - KERNEL_SIZE := 4096k - NETGEAR_BOARD_ID := R7500 - NETGEAR_HW_ID := 29764841+0+128+256+3x3+4x4 - BLOCKSIZE := 128k - PAGESIZE := 2048 - BOARD_NAME := r7500 - SUPPORTED_DEVICES += r7500 - DEVICE_PACKAGES := ath10k-firmware-qca988x-ct -endef -TARGET_DEVICES += netgear_r7500 - -define Device/netgear_r7500v2 - $(call Device/DniImage) - DEVICE_VENDOR := NETGEAR - DEVICE_MODEL := Nighthawk X4 R7500 - DEVICE_VARIANT := v2 - SOC := qcom-ipq8064 - KERNEL_SIZE := 4096k - NETGEAR_BOARD_ID := R7500v2 - NETGEAR_HW_ID := 29764958+0+128+512+3x3+4x4 - BLOCKSIZE := 128k - PAGESIZE := 2048 - BOARD_NAME := r7500v2 - SUPPORTED_DEVICES += r7500v2 - DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct ath10k-firmware-qca988x-ct -endef -TARGET_DEVICES += netgear_r7500v2 - -define Device/netgear_r7800 - $(call Device/DniImage) - DEVICE_VENDOR := NETGEAR - DEVICE_MODEL := Nighthawk X4S R7800 - SOC := qcom-ipq8065 - KERNEL_SIZE := 4096k - NETGEAR_BOARD_ID := R7800 - NETGEAR_HW_ID := 29764958+0+128+512+4x4+4x4+cascade - BLOCKSIZE := 128k - PAGESIZE := 2048 - BOARD_NAME := r7800 - SUPPORTED_DEVICES += r7800 - DEVICE_PACKAGES := ath10k-firmware-qca9984-ct -endef -TARGET_DEVICES += netgear_r7800 - -define Device/netgear_xr500 - $(call Device/DniImage) - DEVICE_VENDOR := NETGEAR - DEVICE_MODEL := Nighthawk XR500 - SOC := qcom-ipq8065 - KERNEL_SIZE := 4096k - NETGEAR_BOARD_ID := XR500 - NETGEAR_HW_ID := 29764958+0+256+512+4x4+4x4+cascade - BLOCKSIZE := 128k - PAGESIZE := 2048 - DEVICE_PACKAGES := ath10k-firmware-qca9984-ct -endef -TARGET_DEVICES += netgear_xr500 - -define Device/qcom_ipq8064-ap148 - $(call Device/FitImage) - $(call Device/UbiFit) - DEVICE_VENDOR := Qualcomm - DEVICE_MODEL := AP148 - DEVICE_VARIANT := standard - SOC := qcom-ipq8064 - DEVICE_DTS := qcom-ipq8064-ap148 - KERNEL_INSTALL := 1 - BLOCKSIZE := 128k - PAGESIZE := 2048 - BOARD_NAME := ap148 - SUPPORTED_DEVICES += ap148 - DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct -endef -TARGET_DEVICES += qcom_ipq8064-ap148 - -define Device/qcom_ipq8064-ap148-legacy - $(call Device/LegacyImage) - $(call Device/UbiFit) - DEVICE_VENDOR := Qualcomm - DEVICE_MODEL := AP148 - DEVICE_VARIANT := legacy - SOC := qcom-ipq8064 - DEVICE_DTS := qcom-ipq8064-ap148 - BLOCKSIZE := 128k - PAGESIZE := 2048 - BOARD_NAME := ap148 - SUPPORTED_DEVICES := qcom,ipq8064-ap148 ap148 - DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct -endef -TARGET_DEVICES += qcom_ipq8064-ap148-legacy - -define Device/qcom_ipq8064-ap161 - $(call Device/FitImage) - $(call Device/UbiFit) - DEVICE_VENDOR := Qualcomm - DEVICE_MODEL := AP161 - SOC := qcom-ipq8064 - DEVICE_DTS := qcom-ipq8064-ap161 - KERNEL_INSTALL := 1 - BLOCKSIZE := 128k - PAGESIZE := 2048 - BOARD_NAME := ap161 - DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct -endef -TARGET_DEVICES += qcom_ipq8064-ap161 - -define Device/qcom_ipq8064-db149 - $(call Device/FitImage) - DEVICE_VENDOR := Qualcomm - DEVICE_MODEL := DB149 - SOC := qcom-ipq8064 - DEVICE_DTS := qcom-ipq8064-db149 - KERNEL_INSTALL := 1 - BOARD_NAME := db149 - DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct -endef -TARGET_DEVICES += qcom_ipq8064-db149 - -define Device/tplink_ad7200 - $(call Device/TpSafeImage) - DEVICE_VENDOR := TP-Link - DEVICE_MODEL := AD7200 - DEVICE_VARIANT := v1/v2 - DEVICE_ALT0_VENDOR := TP-Link - DEVICE_ALT0_MODEL := Talon AD7200 - DEVICE_ALT0_VARIANT := v1/v2 - SOC := qcom-ipq8064 - BLOCKSIZE := 128k - PAGESIZE := 2048 - TPLINK_BOARD_ID := AD7200 - DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct kmod-wil6210 -endef -TARGET_DEVICES += tplink_ad7200 - -define Device/tplink_c2600 - $(call Device/TpSafeImage) - DEVICE_VENDOR := TP-Link - DEVICE_MODEL := Archer C2600 - DEVICE_VARIANT := v1 - SOC := qcom-ipq8064 - BLOCKSIZE := 128k - PAGESIZE := 2048 - BOARD_NAME := c2600 - SUPPORTED_DEVICES += c2600 - TPLINK_BOARD_ID := C2600 - DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct -endef -TARGET_DEVICES += tplink_c2600 - -define Device/tplink_vr2600v - DEVICE_VENDOR := TP-Link - DEVICE_MODEL := Archer VR2600v - DEVICE_VARIANT := v1 - KERNEL_SUFFIX := -uImage - KERNEL = kernel-bin | append-dtb | uImage none - KERNEL_NAME := zImage - KERNEL_SIZE := 3072k - SOC := qcom-ipq8064 - BLOCKSIZE := 128k - PAGESIZE := 2048 - BOARD_NAME := vr2600v - SUPPORTED_DEVICES += vr2600v - DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct - IMAGE/sysupgrade.bin := pad-extra 512 | append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | append-metadata - DEFAULT := n -endef -TARGET_DEVICES += tplink_vr2600v - -define Device/ubnt_unifi-ac-hd - $(call Device/FitImageLzma) - DEVICE_VENDOR := Ubiquiti - DEVICE_MODEL := UniFi AC HD - SOC := qcom-ipq8064 - BLOCKSIZE := 64k - IMAGE_SIZE := 14784k - DEVICE_PACKAGES := ath10k-firmware-qca9984-ct - IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size | append-metadata -endef -TARGET_DEVICES += ubnt_unifi-ac-hd - -define Device/zyxel_nbg6817 - DEVICE_VENDOR := ZyXEL - DEVICE_MODEL := NBG6817 - SOC := qcom-ipq8065 - KERNEL_SIZE := 4096k - BLOCKSIZE := 64k - BOARD_NAME := nbg6817 - RAS_BOARD := NBG6817 - RAS_ROOTFS_SIZE := 20934k - RAS_VERSION := "V1.99(OWRT.9999)C0" - SUPPORTED_DEVICES += nbg6817 - DEVICE_PACKAGES := ath10k-firmware-qca9984-ct e2fsprogs kmod-fs-ext4 losetup - $(call Device/ZyXELImage) -endef -TARGET_DEVICES += zyxel_nbg6817 +include $(SUBTARGET).mk $(eval $(call BuildImage)) diff --git a/target/linux/ipq806x/image/generic.mk b/target/linux/ipq806x/image/generic.mk new file mode 100644 index 0000000000..524eb98226 --- /dev/null +++ b/target/linux/ipq806x/image/generic.mk @@ -0,0 +1,452 @@ +DEVICE_VARS += NETGEAR_BOARD_ID NETGEAR_HW_ID +DEVICE_VARS += TPLINK_BOARD_ID + +define Build/buffalo-rootfs-cksum + ( \ + echo -ne "\x$$(od -A n -t u1 $@ | tr -s ' ' '\n' | \ + $(STAGING_DIR_HOST)/bin/awk '{s+=$$0}END{printf "%x", 255-s%256}')"; \ + ) >> $@ +endef + +define Build/edimax-header + $(eval edimax_model=$(word 1,$(1))) + + $(STAGING_DIR_HOST)/bin/mkedimaximg \ + -b -s CSYS -m $(edimax_model) \ + -f 0x70000 -S 0x1200000 \ + -i $@ -o $@.new + @mv $@.new $@ +endef + +define Device/DniImage + KERNEL_SUFFIX := -uImage + KERNEL = kernel-bin | append-dtb | uImage none + KERNEL_NAME := zImage + NETGEAR_BOARD_ID := + NETGEAR_HW_ID := + UBINIZE_OPTS := -E 5 + IMAGES += factory.img + IMAGE/factory.img := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | \ + append-uImage-fakehdr filesystem | pad-to $$$$(KERNEL_SIZE) | \ + append-ubi | netgear-dni + IMAGE/sysupgrade.bin := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | \ + append-uImage-fakehdr filesystem | sysupgrade-tar kernel=$$$$@ | \ + append-metadata +endef + +define Device/TpSafeImage + KERNEL_SUFFIX := -uImage + KERNEL = kernel-bin | append-dtb | uImage none + KERNEL_NAME := zImage + TPLINK_BOARD_ID := + IMAGES += factory.bin + IMAGE/factory.bin := append-rootfs | tplink-safeloader factory + IMAGE/sysupgrade.bin := append-rootfs | \ + tplink-safeloader sysupgrade | append-metadata +endef + +define Device/ZyXELImage + KERNEL_SUFFIX := -uImage + KERNEL = kernel-bin | append-dtb | uImage none | \ + pad-to $$(KERNEL_SIZE) + KERNEL_NAME := zImage + IMAGES += factory.bin + IMAGE/factory.bin := append-rootfs | pad-rootfs | \ + pad-to $$$$(BLOCKSIZE) | zyxel-ras-image separate-kernel + IMAGE/sysupgrade.bin/squashfs := append-rootfs | \ + pad-to $$$$(BLOCKSIZE) | sysupgrade-tar rootfs=$$$$@ | \ + append-metadata +endef + +define Device/askey_rt4230w-rev6 + $(call Device/LegacyImage) + DEVICE_VENDOR := Askey + DEVICE_MODEL := RT4230W + DEVICE_VARIANT := REV6 + SOC := qcom-ipq8065 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_PACKAGES := ath10k-firmware-qca9984-ct + KERNEL_IN_UBI := 1 +endef +TARGET_DEVICES += askey_rt4230w-rev6 + +define Device/asrock_g10 + $(call Device/FitImage) + $(call Device/UbiFit) + SOC := qcom-ipq8064 + DEVICE_VENDOR := ASRock + DEVICE_MODEL := G10 + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_SIZE := 5332k + DEVICE_PACKAGES := kmod-i2c-gpio ath10k-firmware-qca99x0-ct + IMAGE/nand-factory.bin := append-ubi | edimax-header RN67 +endef +TARGET_DEVICES += asrock_g10 + +define Device/buffalo_wxr-2533dhp + $(call Device/LegacyImage) + SOC := qcom-ipq8064 + DEVICE_VENDOR := Buffalo + DEVICE_MODEL := WXR-2533DHP + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 65536k + KERNEL_IN_UBI := 1 + IMAGE/sysupgrade.bin := append-rootfs | buffalo-rootfs-cksum | \ + sysupgrade-tar rootfs=$$$$@ | append-metadata + DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct +endef +TARGET_DEVICES += buffalo_wxr-2533dhp + +define Device/compex_wpq864 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := Compex + DEVICE_MODEL := WPQ864 + BLOCKSIZE := 128k + PAGESIZE := 2048 + SOC := qcom-ipq8064 + DEVICE_PACKAGES := kmod-gpio-beeper +endef +TARGET_DEVICES += compex_wpq864 + +define Device/edgecore_ecw5410 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := Edgecore + DEVICE_MODEL := ECW5410 + SOC := qcom-ipq8068 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_DTS_CONFIG := config@v2.0-ap160 + DEVICE_PACKAGES := ath10k-firmware-qca9984-ct \ + ipq-wifi-edgecore_ecw5410 +endef +TARGET_DEVICES += edgecore_ecw5410 + +define Device/linksys_ea7500-v1 + $(call Device/LegacyImage) + DEVICE_VENDOR := Linksys + DEVICE_MODEL := EA7500 + DEVICE_VARIANT := v1 + SOC := qcom-ipq8064 + PAGESIZE := 2048 + BLOCKSIZE := 128k + KERNEL_SIZE := 3072k + KERNEL = kernel-bin | append-dtb | uImage none | \ + append-uImage-fakehdr filesystem + UBINIZE_OPTS := -E 5 + IMAGES := factory.bin sysupgrade.bin + IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | \ + append-ubi | pad-to $$$$(PAGESIZE) + DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct +endef +TARGET_DEVICES += linksys_ea7500-v1 + +define Device/linksys_ea8500 + $(call Device/LegacyImage) + DEVICE_VENDOR := Linksys + DEVICE_MODEL := EA8500 + SOC := qcom-ipq8064 + PAGESIZE := 2048 + BLOCKSIZE := 128k + KERNEL_SIZE := 3072k + KERNEL = kernel-bin | append-dtb | uImage none | \ + append-uImage-fakehdr filesystem + BOARD_NAME := ea8500 + SUPPORTED_DEVICES += ea8500 + UBINIZE_OPTS := -E 5 + IMAGES += factory.bin + IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | \ + append-ubi + DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct +endef +TARGET_DEVICES += linksys_ea8500 + +define Device/meraki_mr42 + $(call Device/FitImage) + DEVICE_VENDOR := Cisco Meraki + DEVICE_MODEL := MR42 + SOC := qcom-ipq8068 + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_LOADADDR = 0x44208000 + DEVICE_PACKAGES := -swconfig -kmod-ata-ahci -kmod-ata-ahci-platform \ + -kmod-usb-ohci -kmod-usb2 -kmod-usb-ledtrig-usbport \ + -kmod-phy-qcom-ipq806x-usb -kmod-usb3 -kmod-usb-dwc3-qcom \ + -uboot-envtools ath10k-firmware-qca9887-ct \ + ath10k-firmware-qca99x0-ct kmod-eeprom-at24 kmod-hwmon-ina2xx \ + kmod-leds-tlc591xx +endef +TARGET_DEVICES += meraki_mr42 + +define Device/meraki_mr52 + $(call Device/FitImage) + DEVICE_VENDOR := Cisco Meraki + DEVICE_MODEL := MR52 + SOC := qcom-ipq8068 + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_LOADADDR = 0x44208000 + DEVICE_DTS_CONFIG := config@2 + DEVICE_PACKAGES := -swconfig -kmod-ata-ahci -kmod-ata-ahci-platform \ + -kmod-usb-ohci -kmod-usb2 -kmod-usb-ledtrig-usbport \ + -kmod-phy-qcom-ipq806x-usb -kmod-usb3 -kmod-usb-dwc3-qcom \ + -uboot-envtools ath10k-firmware-qca9887-ct \ + ath10k-firmware-qca9984-ct kmod-eeprom-at24 kmod-hwmon-ina2xx \ + kmod-leds-tlc591xx +endef +TARGET_DEVICES += meraki_mr52 + +define Device/nec_wg2600hp + $(call Device/LegacyImage) + DEVICE_VENDOR := NEC + DEVICE_MODEL := Aterm WG2600HP + SOC := qcom-ipq8064 + BLOCKSIZE := 64k + BOARD_NAME := wg2600hp + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \ + pad-rootfs | append-metadata + DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct +endef +TARGET_DEVICES += nec_wg2600hp + +define Device/nec_wg2600hp3 + $(call Device/LegacyImage) + DEVICE_VENDOR := NEC Platforms + DEVICE_MODEL := Aterm WG2600HP3 + SOC := qcom-ipq8062 + BLOCKSIZE := 64k + IMAGES := sysupgrade.bin + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \ + pad-rootfs | append-metadata + DEVICE_PACKAGES := -kmod-ata-ahci -kmod-ata-ahci-platform \ + -kmod-usb-ohci -kmod-usb2 -kmod-usb-ledtrig-usbport \ + -kmod-usb-phy-qcom-dwc3 -kmod-usb3 -kmod-usb-dwc3-qcom \ + ath10k-firmware-qca9984-ct ipq-wifi-nec_wg2600hp3 +endef +TARGET_DEVICES += nec_wg2600hp3 + +define Device/netgear_d7800 + $(call Device/DniImage) + DEVICE_VENDOR := NETGEAR + DEVICE_MODEL := Nighthawk X4 D7800 + SOC := qcom-ipq8064 + KERNEL_SIZE := 4096k + NETGEAR_BOARD_ID := D7800 + NETGEAR_HW_ID := 29764958+0+128+512+4x4+4x4 + BLOCKSIZE := 128k + PAGESIZE := 2048 + BOARD_NAME := d7800 + SUPPORTED_DEVICES += d7800 + DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct +endef +TARGET_DEVICES += netgear_d7800 + +define Device/netgear_r7500 + $(call Device/DniImage) + DEVICE_VENDOR := NETGEAR + DEVICE_MODEL := Nighthawk X4 R7500 + DEVICE_VARIANT := v1 + SOC := qcom-ipq8064 + KERNEL_SIZE := 4096k + NETGEAR_BOARD_ID := R7500 + NETGEAR_HW_ID := 29764841+0+128+256+3x3+4x4 + BLOCKSIZE := 128k + PAGESIZE := 2048 + BOARD_NAME := r7500 + SUPPORTED_DEVICES += r7500 + DEVICE_PACKAGES := ath10k-firmware-qca988x-ct +endef +TARGET_DEVICES += netgear_r7500 + +define Device/netgear_r7500v2 + $(call Device/DniImage) + DEVICE_VENDOR := NETGEAR + DEVICE_MODEL := Nighthawk X4 R7500 + DEVICE_VARIANT := v2 + SOC := qcom-ipq8064 + KERNEL_SIZE := 4096k + NETGEAR_BOARD_ID := R7500v2 + NETGEAR_HW_ID := 29764958+0+128+512+3x3+4x4 + BLOCKSIZE := 128k + PAGESIZE := 2048 + BOARD_NAME := r7500v2 + SUPPORTED_DEVICES += r7500v2 + DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct \ + ath10k-firmware-qca988x-ct +endef +TARGET_DEVICES += netgear_r7500v2 + +define Device/netgear_r7800 + $(call Device/DniImage) + DEVICE_VENDOR := NETGEAR + DEVICE_MODEL := Nighthawk X4S R7800 + SOC := qcom-ipq8065 + KERNEL_SIZE := 4096k + NETGEAR_BOARD_ID := R7800 + NETGEAR_HW_ID := 29764958+0+128+512+4x4+4x4+cascade + BLOCKSIZE := 128k + PAGESIZE := 2048 + BOARD_NAME := r7800 + SUPPORTED_DEVICES += r7800 + DEVICE_PACKAGES := ath10k-firmware-qca9984-ct +endef +TARGET_DEVICES += netgear_r7800 + +define Device/netgear_xr500 + $(call Device/DniImage) + DEVICE_VENDOR := NETGEAR + DEVICE_MODEL := Nighthawk XR500 + SOC := qcom-ipq8065 + KERNEL_SIZE := 4096k + NETGEAR_BOARD_ID := XR500 + NETGEAR_HW_ID := 29764958+0+256+512+4x4+4x4+cascade + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_PACKAGES := ath10k-firmware-qca9984-ct +endef +TARGET_DEVICES += netgear_xr500 + +define Device/qcom_ipq8064-ap148 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := Qualcomm + DEVICE_MODEL := AP148 + DEVICE_VARIANT := standard + SOC := qcom-ipq8064 + DEVICE_DTS := qcom-ipq8064-ap148 + KERNEL_INSTALL := 1 + BLOCKSIZE := 128k + PAGESIZE := 2048 + BOARD_NAME := ap148 + SUPPORTED_DEVICES += ap148 + DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct +endef +TARGET_DEVICES += qcom_ipq8064-ap148 + +define Device/qcom_ipq8064-ap148-legacy + $(call Device/LegacyImage) + $(call Device/UbiFit) + DEVICE_VENDOR := Qualcomm + DEVICE_MODEL := AP148 + DEVICE_VARIANT := legacy + SOC := qcom-ipq8064 + DEVICE_DTS := qcom-ipq8064-ap148 + BLOCKSIZE := 128k + PAGESIZE := 2048 + BOARD_NAME := ap148 + SUPPORTED_DEVICES := qcom,ipq8064-ap148 ap148 + DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct +endef +TARGET_DEVICES += qcom_ipq8064-ap148-legacy + +define Device/qcom_ipq8064-ap161 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := Qualcomm + DEVICE_MODEL := AP161 + SOC := qcom-ipq8064 + DEVICE_DTS := qcom-ipq8064-ap161 + KERNEL_INSTALL := 1 + BLOCKSIZE := 128k + PAGESIZE := 2048 + BOARD_NAME := ap161 + DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct +endef +TARGET_DEVICES += qcom_ipq8064-ap161 + +define Device/qcom_ipq8064-db149 + $(call Device/FitImage) + DEVICE_VENDOR := Qualcomm + DEVICE_MODEL := DB149 + SOC := qcom-ipq8064 + DEVICE_DTS := qcom-ipq8064-db149 + KERNEL_INSTALL := 1 + BOARD_NAME := db149 + DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct +endef +TARGET_DEVICES += qcom_ipq8064-db149 + +define Device/tplink_ad7200 + $(call Device/TpSafeImage) + DEVICE_VENDOR := TP-Link + DEVICE_MODEL := AD7200 + DEVICE_VARIANT := v1/v2 + DEVICE_ALT0_VENDOR := TP-Link + DEVICE_ALT0_MODEL := Talon AD7200 + DEVICE_ALT0_VARIANT := v1/v2 + SOC := qcom-ipq8064 + BLOCKSIZE := 128k + PAGESIZE := 2048 + TPLINK_BOARD_ID := AD7200 + DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct kmod-wil6210 +endef +TARGET_DEVICES += tplink_ad7200 + +define Device/tplink_c2600 + $(call Device/TpSafeImage) + DEVICE_VENDOR := TP-Link + DEVICE_MODEL := Archer C2600 + DEVICE_VARIANT := v1 + SOC := qcom-ipq8064 + BLOCKSIZE := 128k + PAGESIZE := 2048 + BOARD_NAME := c2600 + SUPPORTED_DEVICES += c2600 + TPLINK_BOARD_ID := C2600 + DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct +endef +TARGET_DEVICES += tplink_c2600 + +define Device/tplink_vr2600v + DEVICE_VENDOR := TP-Link + DEVICE_MODEL := Archer VR2600v + DEVICE_VARIANT := v1 + KERNEL_SUFFIX := -uImage + KERNEL = kernel-bin | append-dtb | uImage none + KERNEL_NAME := zImage + KERNEL_SIZE := 3072k + SOC := qcom-ipq8064 + BLOCKSIZE := 128k + PAGESIZE := 2048 + BOARD_NAME := vr2600v + SUPPORTED_DEVICES += vr2600v + DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct + IMAGE/sysupgrade.bin := pad-extra 512 | append-kernel | \ + pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | \ + append-metadata +endef +TARGET_DEVICES += tplink_vr2600v + +define Device/ubnt_unifi-ac-hd + $(call Device/FitImageLzma) + DEVICE_VENDOR := Ubiquiti + DEVICE_MODEL := UniFi AC HD + SOC := qcom-ipq8064 + BLOCKSIZE := 64k + IMAGE_SIZE := 14784k + DEVICE_PACKAGES := ath10k-firmware-qca9984-ct + IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \ + append-rootfs | pad-rootfs | check-size | append-metadata +endef +TARGET_DEVICES += ubnt_unifi-ac-hd + +define Device/zyxel_nbg6817 + DEVICE_VENDOR := ZyXEL + DEVICE_MODEL := NBG6817 + SOC := qcom-ipq8065 + KERNEL_SIZE := 4096k + BLOCKSIZE := 64k + BOARD_NAME := nbg6817 + RAS_BOARD := NBG6817 + RAS_ROOTFS_SIZE := 20934k + RAS_VERSION := "V1.99(OWRT.9999)C0" + SUPPORTED_DEVICES += nbg6817 + DEVICE_PACKAGES := ath10k-firmware-qca9984-ct e2fsprogs \ + kmod-fs-ext4 losetup + $(call Device/ZyXELImage) +endef +TARGET_DEVICES += zyxel_nbg6817 diff --git a/target/linux/ipq807x/Makefile b/target/linux/ipq807x/Makefile deleted file mode 100644 index dab05ca204..0000000000 --- a/target/linux/ipq807x/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -include $(TOPDIR)/rules.mk - -ARCH:=aarch64 -BOARD:=ipq807x -BOARDNAME:=Qualcomm Atheros IPQ807x -FEATURES:=squashfs ramdisk source-only -KERNELNAME:=Image dtbs -CPU_TYPE:=cortex-a53 - -KERNEL_PATCHVER:=5.4 - -include $(INCLUDE_DIR)/target.mk - -$(eval $(call BuildTarget)) diff --git a/target/linux/ipq807x/config-default b/target/linux/ipq807x/config-default deleted file mode 100644 index ad4aca1b48..0000000000 --- a/target/linux/ipq807x/config-default +++ /dev/null @@ -1,643 +0,0 @@ -CONFIG_64BIT=y -# CONFIG_ACPI is not set -# CONFIG_ALLOW_DEV_COREDUMP is not set -# CONFIG_APQ_GCC_8084 is not set -# CONFIG_APQ_MMCC_8084 is not set -CONFIG_AQUANTIA_PHY=y -CONFIG_ARCH_CLOCKSOURCE_DATA=y -CONFIG_ARCH_DMA_ADDR_T_64BIT=y -CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y -CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y -CONFIG_ARCH_HAS_ELF_RANDOMIZE=y -CONFIG_ARCH_HAS_FAST_MULTIPLIER=y -CONFIG_ARCH_HAS_FORTIFY_SOURCE=y -CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y -CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y -CONFIG_ARCH_HAS_KCOV=y -CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y -CONFIG_ARCH_HAS_PTE_SPECIAL=y -CONFIG_ARCH_HAS_SET_MEMORY=y -CONFIG_ARCH_HAS_SG_CHAIN=y -CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y -CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y -CONFIG_ARCH_HAS_SYSCALL_WRAPPER=y -CONFIG_ARCH_HAS_TICK_BROADCAST=y -CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_MMAP_RND_BITS=18 -CONFIG_ARCH_MMAP_RND_BITS_MAX=24 -CONFIG_ARCH_MMAP_RND_BITS_MIN=18 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS=11 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 -CONFIG_ARCH_PROC_KCORE_TEXT=y -CONFIG_ARCH_QCOM=y -CONFIG_ARCH_SELECT_MEMORY_MODEL=y -CONFIG_ARCH_SPARSEMEM_DEFAULT=y -CONFIG_ARCH_SPARSEMEM_ENABLE=y -CONFIG_ARCH_SUPPORTS_ACPI=y -CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y -CONFIG_ARCH_SUPPORTS_INT128=y -CONFIG_ARCH_SUPPORTS_MEMORY_FAILURE=y -CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y -CONFIG_ARCH_SUPPORTS_UPROBES=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -CONFIG_ARCH_USE_QUEUED_RWLOCKS=y -CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y -CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y -CONFIG_ARCH_WANT_FRAME_POINTERS=y -CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y -CONFIG_ARM64=y -# CONFIG_ARM64_16K_PAGES is not set -CONFIG_ARM64_4K_PAGES=y -# CONFIG_ARM64_64K_PAGES is not set -CONFIG_ARM64_CONT_SHIFT=4 -# CONFIG_ARM64_CRYPTO is not set -CONFIG_ARM64_ERRATUM_819472=y -CONFIG_ARM64_ERRATUM_824069=y -CONFIG_ARM64_ERRATUM_826319=y -CONFIG_ARM64_ERRATUM_827319=y -CONFIG_ARM64_ERRATUM_832075=y -CONFIG_ARM64_ERRATUM_843419=y -CONFIG_ARM64_ERRATUM_845719=y -CONFIG_ARM64_HW_AFDBM=y -# CONFIG_ARM64_LSE_ATOMICS is not set -CONFIG_ARM64_MODULE_PLTS=y -CONFIG_ARM64_PAGE_SHIFT=12 -CONFIG_ARM64_PAN=y -CONFIG_ARM64_PA_BITS=48 -CONFIG_ARM64_PA_BITS_48=y -# CONFIG_ARM64_PMEM is not set -# CONFIG_ARM64_PTDUMP_DEBUGFS is not set -# CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET is not set -CONFIG_ARM64_SSBD=y -CONFIG_ARM64_SVE=y -CONFIG_ARM64_UAO=y -CONFIG_ARM64_VA_BITS=39 -CONFIG_ARM64_VA_BITS_39=y -# CONFIG_ARM64_VA_BITS_48 is not set -CONFIG_ARM64_VHE=y -# CONFIG_ARMV8_DEPRECATED is not set -CONFIG_ARM_AMBA=y -CONFIG_ARM_ARCH_TIMER=y -CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y -CONFIG_ARM_CCI=y -CONFIG_ARM_CCI400_COMMON=y -CONFIG_ARM_CCI400_PMU=y -CONFIG_ARM_CCI_PMU=y -CONFIG_ARM_CPUIDLE=y -CONFIG_ARM_GIC=y -CONFIG_ARM_GIC_V2M=y -CONFIG_ARM_GIC_V3=y -CONFIG_ARM_GIC_V3_ITS=y -CONFIG_ARM_GIC_V3_ITS_PCI=y -CONFIG_ARM_PMU=y -CONFIG_ARM_PSCI_FW=y -# CONFIG_ARM_QCOM_CPUFREQ_KRYO is not set -# CONFIG_ARM_SCMI_PROTOCOL is not set -# CONFIG_ARM_SP805_WATCHDOG is not set -CONFIG_ASN1=y -CONFIG_ASSOCIATIVE_ARRAY=y -CONFIG_ASYMMETRIC_KEY_TYPE=y -CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y -CONFIG_AT803X_PHY=y -CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y -CONFIG_BLK_DEV_NVME=y -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_COUNT=16 -CONFIG_BLK_DEV_RAM_SIZE=4096 -CONFIG_BLK_MQ_PCI=y -CONFIG_BLK_MQ_VIRTIO=y -CONFIG_BLOCK_COMPAT=y -CONFIG_BUILD_BIN2C=y -# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set -CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CLEANCACHE=y -CONFIG_CLKDEV_LOOKUP=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_CLZ_TAB=y -CONFIG_COMMON_CLK=y -CONFIG_COMMON_CLK_QCOM=y -CONFIG_COMMON_CLK_XGENE=y -CONFIG_COMPAT=y -CONFIG_COMPAT_32BIT_TIME=y -CONFIG_COMPAT_BINFMT_ELF=y -CONFIG_COMPAT_NETLINK_MESSAGES=y -CONFIG_COMPAT_OLD_SIGACTION=y -CONFIG_CONFIGFS_FS=y -CONFIG_COREDUMP=y -CONFIG_CORESIGHT=y -# CONFIG_CORESIGHT_CATU is not set -# CONFIG_CORESIGHT_CPU_DEBUG is not set -# CONFIG_CORESIGHT_DYNAMIC_REPLICATOR is not set -CONFIG_CORESIGHT_LINKS_AND_SINKS=y -CONFIG_CORESIGHT_LINK_AND_SINK_TMC=y -# CONFIG_CORESIGHT_SINK_ETBV10 is not set -CONFIG_CORESIGHT_SINK_TPIU=y -CONFIG_CORESIGHT_SOURCE_ETM4X=y -CONFIG_CORESIGHT_STM=y -CONFIG_CPUFREQ_DT=y -CONFIG_CPUFREQ_DT_PLATDEV=y -# CONFIG_CPU_BIG_ENDIAN is not set -CONFIG_CPU_FREQ=y -CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y -CONFIG_CPU_FREQ_GOV_ATTR_SET=y -CONFIG_CPU_FREQ_GOV_COMMON=y -CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y -CONFIG_CPU_FREQ_GOV_ONDEMAND=y -CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -CONFIG_CPU_FREQ_GOV_POWERSAVE=y -CONFIG_CPU_FREQ_GOV_USERSPACE=y -CONFIG_CPU_FREQ_STAT=y -# CONFIG_CPU_HOTPLUG_STATE_CONTROL is not set -CONFIG_CPU_IDLE=y -CONFIG_CPU_IDLE_GOV_LADDER=y -CONFIG_CPU_IDLE_GOV_MENU=y -CONFIG_CPU_IDLE_MULTIPLE_DRIVERS=y -CONFIG_CPU_PM=y -CONFIG_CPU_RMAP=y -# CONFIG_CPU_THERMAL is not set -CONFIG_CRC16=y -# CONFIG_CRC32_SARWATE is not set -CONFIG_CRC32_SLICEBY8=y -CONFIG_CROSS_MEMORY_ATTACH=y -CONFIG_CRYPTO_ACOMP2=y -CONFIG_CRYPTO_AEAD=y -CONFIG_CRYPTO_AEAD2=y -CONFIG_CRYPTO_AKCIPHER=y -CONFIG_CRYPTO_AKCIPHER2=y -CONFIG_CRYPTO_ARC4=y -CONFIG_CRYPTO_CCM=y -CONFIG_CRYPTO_CMAC=y -CONFIG_CRYPTO_CRC32C=y -CONFIG_CRYPTO_CTR=y -CONFIG_CRYPTO_DEFLATE=y -# CONFIG_CRYPTO_DEV_QCOM_RNG is not set -CONFIG_CRYPTO_DRBG=y -CONFIG_CRYPTO_DRBG_HMAC=y -CONFIG_CRYPTO_DRBG_MENU=y -CONFIG_CRYPTO_ECHAINIV=y -CONFIG_CRYPTO_GCM=y -CONFIG_CRYPTO_GF128MUL=y -CONFIG_CRYPTO_GHASH=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_HASH_INFO=y -CONFIG_CRYPTO_HMAC=y -CONFIG_CRYPTO_HW=y -CONFIG_CRYPTO_JITTERENTROPY=y -CONFIG_CRYPTO_KPP2=y -CONFIG_CRYPTO_LZO=y -CONFIG_CRYPTO_MANAGER=y -CONFIG_CRYPTO_MANAGER2=y -# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set -CONFIG_CRYPTO_NULL=y -CONFIG_CRYPTO_NULL2=y -CONFIG_CRYPTO_RNG=y -CONFIG_CRYPTO_RNG2=y -CONFIG_CRYPTO_RNG_DEFAULT=y -CONFIG_CRYPTO_SEQIV=y -CONFIG_CRYPTO_SHA256=y -CONFIG_CRYPTO_SHA512=y -CONFIG_CRYPTO_WORKQUEUE=y -CONFIG_DCACHE_WORD_ACCESS=y -CONFIG_DEBUG_BUGVERBOSE=y -CONFIG_DEBUG_GPIO=y -CONFIG_DECOMPRESS_GZIP=y -CONFIG_DEVMEM=y -CONFIG_DMADEVICES=y -CONFIG_DMA_DIRECT_OPS=y -CONFIG_DMA_ENGINE=y -CONFIG_DMA_OF=y -CONFIG_DMA_VIRTUAL_CHANNELS=y -CONFIG_DMI=y -CONFIG_DMIID=y -# CONFIG_DMI_SYSFS is not set -CONFIG_DTC=y -CONFIG_DT_IDLE_STATES=y -CONFIG_DYNAMIC_DEBUG=y -CONFIG_EDAC_SUPPORT=y -CONFIG_EFI=y -CONFIG_EFIVAR_FS=m -CONFIG_EFI_ARMSTUB=y -CONFIG_EFI_ARMSTUB_DTB_LOADER=y -# CONFIG_EFI_CAPSULE_LOADER is not set -CONFIG_EFI_ESRT=y -CONFIG_EFI_PARAMS_FROM_FDT=y -CONFIG_EFI_RUNTIME_WRAPPERS=y -CONFIG_EFI_STUB=y -# CONFIG_EFI_TEST is not set -# CONFIG_EFI_VARS is not set -CONFIG_EXT4_FS=y -# CONFIG_EXT4_USE_FOR_EXT2 is not set -CONFIG_FB=y -CONFIG_FB_CMDLINE=y -# CONFIG_FB_EFI is not set -CONFIG_FIXED_PHY=y -CONFIG_FIX_EARLYCON_MEM=y -# CONFIG_FLATMEM_MANUAL is not set -CONFIG_FRAME_POINTER=y -CONFIG_FRAME_WARN=2048 -CONFIG_FREEZER=y -CONFIG_FS_IOMAP=y -CONFIG_FS_MBCACHE=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_GENERIC_ARCH_TOPOLOGY=y -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y -CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_GENERIC_CPU_VULNERABILITIES=y -CONFIG_GENERIC_CSUM=y -CONFIG_GENERIC_EARLY_IOREMAP=y -CONFIG_GENERIC_IDLE_POLL_SETUP=y -CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y -CONFIG_GENERIC_IRQ_MIGRATION=y -CONFIG_GENERIC_IRQ_MULTI_HANDLER=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_IRQ_SHOW_LEVEL=y -CONFIG_GENERIC_MSI_IRQ=y -CONFIG_GENERIC_MSI_IRQ_DOMAIN=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_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -CONFIG_GENERIC_TIME_VSYSCALL=y -CONFIG_GPIOLIB=y -CONFIG_GPIOLIB_IRQCHIP=y -CONFIG_HANDLE_DOMAIN_IRQ=y -CONFIG_HARDEN_BRANCH_PREDICTOR=y -CONFIG_HARDIRQS_SW_RESEND=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y -CONFIG_HAVE_ARCH_AUDITSYSCALL=y -CONFIG_HAVE_ARCH_BITREVERSE=y -CONFIG_HAVE_ARCH_HUGE_VMAP=y -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_HAVE_ARCH_KASAN=y -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y -CONFIG_HAVE_ARCH_PFN_VALID=y -CONFIG_HAVE_ARCH_PREL32_RELOCATIONS=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_HAVE_ARCH_THREAD_STRUCT_WHITELIST=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y -CONFIG_HAVE_ARCH_VMAP_STACK=y -CONFIG_HAVE_ARM_SMCCC=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_CLK_PREPARE=y -CONFIG_HAVE_CMPXCHG_DOUBLE=y -CONFIG_HAVE_CMPXCHG_LOCAL=y -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_HAVE_DEBUG_BUGVERBOSE=y -CONFIG_HAVE_DEBUG_KMEMLEAK=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_EBPF_JIT=y -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=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_GENERIC_GUP=y -CONFIG_HAVE_HW_BREAKPOINT=y -CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_HAVE_MEMORY_PRESENT=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_HAVE_NET_DSA=y -CONFIG_HAVE_PATA_PLATFORM=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_HAVE_PERF_REGS=y -CONFIG_HAVE_PERF_USER_STACK_DUMP=y -CONFIG_HAVE_RCU_TABLE_FREE=y -CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y -CONFIG_HAVE_RSEQ=y -CONFIG_HAVE_SCHED_AVG_IRQ=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_UID16=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y -CONFIG_HOLES_IN_ZONE=y -CONFIG_HOTPLUG_CPU=y -# CONFIG_HUGETLBFS is not set -CONFIG_HWSPINLOCK=y -CONFIG_HWSPINLOCK_QCOM=y -CONFIG_HW_RANDOM=y -CONFIG_I2C=y -CONFIG_I2C_BOARDINFO=y -CONFIG_I2C_CHARDEV=y -CONFIG_I2C_COMPAT=y -CONFIG_I2C_HELPER_AUTO=y -CONFIG_I2C_QUP=y -CONFIG_IIO=y -# CONFIG_IIO_BUFFER is not set -# CONFIG_IIO_TRIGGER is not set -CONFIG_IKCONFIG=y -CONFIG_IKCONFIG_PROC=y -CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 -CONFIG_INITRAMFS_SOURCE="" -# CONFIG_IPQ_GCC_4019 is not set -# CONFIG_IPQ_GCC_806X is not set -CONFIG_IPQ_GCC_8074=y -# CONFIG_IPQ_LCC_806X is not set -CONFIG_IRQCHIP=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_DOMAIN_HIERARCHY=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_TIME_ACCOUNTING=y -CONFIG_IRQ_WORK=y -CONFIG_JBD2=y -CONFIG_KEYS=y -CONFIG_KEYS_COMPAT=y -# CONFIG_KVM is not set -CONFIG_LEDS_TLC591XX=y -CONFIG_LIBFDT=y -CONFIG_LOCK_DEBUGGING_SUPPORT=y -CONFIG_LOCK_SPIN_ON_OWNER=y -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_MAILBOX=y -# CONFIG_MAILBOX_TEST is not set -CONFIG_MDIO_BITBANG=y -CONFIG_MDIO_BUS=y -CONFIG_MDIO_DEVICE=y -CONFIG_MDIO_GPIO=y -# CONFIG_MDM_GCC_9615 is not set -# CONFIG_MDM_LCC_9615 is not set -CONFIG_MEMFD_CREATE=y -CONFIG_MFD_QCOM_RPM=y -CONFIG_MFD_SPMI_PMIC=y -CONFIG_MFD_SYSCON=y -CONFIG_MIGRATION=y -CONFIG_MMC=y -CONFIG_MMC_ARMMMCI=y -CONFIG_MMC_BLOCK=y -CONFIG_MMC_BLOCK_MINORS=32 -CONFIG_MMC_QCOM_DML=y -CONFIG_MMC_SDHCI=y -CONFIG_MMC_SDHCI_IO_ACCESSORS=y -CONFIG_MMC_SDHCI_MSM=y -# CONFIG_MMC_SDHCI_PCI is not set -CONFIG_MMC_SDHCI_PLTFM=y -CONFIG_MODULES_TREE_LOOKUP=y -CONFIG_MODULES_USE_ELF_RELA=y -CONFIG_MPILIB=y -# CONFIG_MSM_GCC_8660 is not set -# CONFIG_MSM_GCC_8916 is not set -# CONFIG_MSM_GCC_8960 is not set -# CONFIG_MSM_GCC_8974 is not set -# CONFIG_MSM_GCC_8994 is not set -# CONFIG_MSM_GCC_8996 is not set -# CONFIG_MSM_GCC_8998 is not set -# CONFIG_MSM_LCC_8960 is not set -# CONFIG_MSM_MMCC_8960 is not set -# CONFIG_MSM_MMCC_8974 is not set -# CONFIG_MSM_MMCC_8996 is not set -CONFIG_MTD_CMDLINE_PARTS=y -CONFIG_MTD_M25P80=y -CONFIG_MTD_NAND=y -CONFIG_MTD_NAND_ECC=y -CONFIG_MTD_NAND_QCOM=y -CONFIG_MTD_SPI_NOR=y -CONFIG_MTD_SPLIT_FIRMWARE=y -CONFIG_MTD_SPLIT_FIT_FW=y -CONFIG_MTD_UBI=y -CONFIG_MTD_UBI_BEB_LIMIT=20 -CONFIG_MTD_UBI_BLOCK=y -CONFIG_MTD_UBI_GLUEBI=y -CONFIG_MTD_UBI_WL_THRESHOLD=4096 -CONFIG_MUTEX_SPIN_ON_OWNER=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_SG_DMA_LENGTH=y -CONFIG_NET_FLOW_LIMIT=y -CONFIG_NET_PTP_CLASSIFY=y -CONFIG_NET_SWITCHDEV=y -# CONFIG_NET_VENDOR_CAVIUM is not set -CONFIG_NLS=y -CONFIG_NO_BOOTMEM=y -CONFIG_NO_HZ=y -CONFIG_NO_HZ_COMMON=y -CONFIG_NO_HZ_IDLE=y -CONFIG_NR_CPUS=4 -# CONFIG_NUMA is not set -CONFIG_NVMEM=y -CONFIG_NVME_CORE=y -# CONFIG_NVME_MULTIPATH is not set -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_OF_RESERVED_MEM=y -CONFIG_OID_REGISTRY=y -CONFIG_OLD_SIGSUSPEND3=y -CONFIG_PADATA=y -CONFIG_PANIC_TIMEOUT=5 -CONFIG_PARTITION_PERCPU=y -CONFIG_PCI=y -CONFIG_PCIE_DW=y -CONFIG_PCIE_DW_HOST=y -CONFIG_PCIE_QCOM=y -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_DOMAINS_GENERIC=y -CONFIG_PCI_LABEL=y -CONFIG_PCI_MSI=y -CONFIG_PCI_MSI_IRQ_DOMAIN=y -CONFIG_PGTABLE_LEVELS=3 -CONFIG_PHYLIB=y -CONFIG_PHYS_ADDR_T_64BIT=y -# CONFIG_PHY_QCOM_APQ8064_SATA is not set -# CONFIG_PHY_QCOM_IPQ806X_SATA is not set -# CONFIG_PHY_QCOM_QMP is not set -# CONFIG_PHY_QCOM_QUSB2 is not set -# CONFIG_PHY_QCOM_UFS is not set -CONFIG_PINCTRL=y -# CONFIG_PINCTRL_APQ8064 is not set -# CONFIG_PINCTRL_APQ8084 is not set -# CONFIG_PINCTRL_IPQ4019 is not set -# CONFIG_PINCTRL_IPQ8064 is not set -CONFIG_PINCTRL_IPQ8074=y -# CONFIG_PINCTRL_MDM9615 is not set -CONFIG_PINCTRL_MSM=y -# CONFIG_PINCTRL_MSM8660 is not set -# CONFIG_PINCTRL_MSM8916 is not set -# CONFIG_PINCTRL_MSM8960 is not set -# CONFIG_PINCTRL_MSM8994 is not set -# CONFIG_PINCTRL_MSM8996 is not set -# CONFIG_PINCTRL_MSM8998 is not set -CONFIG_PINCTRL_QCOM_SPMI_PMIC=y -# CONFIG_PINCTRL_QCOM_SSBI_PMIC is not set -# CONFIG_PINCTRL_SDM845 is not set -CONFIG_PM=y -CONFIG_PM_CLK=y -# CONFIG_PM_DEBUG is not set -CONFIG_PM_OPP=y -CONFIG_PM_SLEEP=y -CONFIG_PM_SLEEP_SMP=y -CONFIG_POWER_RESET=y -CONFIG_POWER_RESET_MSM=y -# CONFIG_POWER_RESET_QCOM_PON is not set -CONFIG_POWER_SUPPLY=y -CONFIG_PPS=y -CONFIG_PREEMPT=y -CONFIG_PREEMPT_COUNT=y -# CONFIG_PREEMPT_NONE is not set -CONFIG_PREEMPT_RCU=y -CONFIG_PRINTK_TIME=y -CONFIG_PROC_PAGE_MONITOR=y -CONFIG_PTP_1588_CLOCK=y -CONFIG_PWM=y -CONFIG_PWM_SYSFS=y -CONFIG_QCOM_A53PLL=y -# CONFIG_QCOM_APCS_IPC is not set -CONFIG_QCOM_BAM_DMA=y -# CONFIG_QCOM_CLK_RPM is not set -# CONFIG_QCOM_COINCELL is not set -# CONFIG_QCOM_COMMAND_DB is not set -CONFIG_QCOM_EBI2=y -# CONFIG_QCOM_GENI_SE is not set -CONFIG_QCOM_GSBI=y -# CONFIG_QCOM_LLCC is not set -# CONFIG_QCOM_PDC is not set -CONFIG_QCOM_QFPROM=y -# CONFIG_QCOM_RMTFS_MEM is not set -# CONFIG_QCOM_RPMH is not set -CONFIG_QCOM_SMEM=y -CONFIG_QCOM_SMEM_STATE=y -CONFIG_QCOM_SMP2P=y -# CONFIG_QCOM_SMSM is not set -CONFIG_QCOM_SPMI_VADC=y -CONFIG_QCOM_TSENS=y -CONFIG_QCOM_VADC_COMMON=y -CONFIG_QCOM_WDT=y -# CONFIG_QRTR is not set -CONFIG_QUEUED_RWLOCKS=y -CONFIG_QUEUED_SPINLOCKS=y -# CONFIG_RANDOMIZE_BASE is not set -CONFIG_RATIONAL=y -CONFIG_RD_GZIP=y -CONFIG_REFCOUNT_FULL=y -CONFIG_REGMAP=y -CONFIG_REGMAP_I2C=y -CONFIG_REGMAP_MMIO=y -CONFIG_REGMAP_SPI=y -CONFIG_REGMAP_SPMI=y -CONFIG_REGULATOR=y -CONFIG_REGULATOR_FIXED_VOLTAGE=y -CONFIG_REGULATOR_GPIO=y -CONFIG_REGULATOR_QCOM_RPM=y -CONFIG_REGULATOR_QCOM_SPMI=y -CONFIG_RELAY=y -CONFIG_REMOTEPROC=y -# CONFIG_RESET_ATTACK_MITIGATION is not set -CONFIG_RESET_CONTROLLER=y -# CONFIG_RESET_QCOM_AOSS is not set -CONFIG_RFS_ACCEL=y -# CONFIG_RPMSG_QCOM_GLINK_SMEM is not set -# CONFIG_RPMSG_QCOM_SMD is not set -CONFIG_RPS=y -CONFIG_RTC_CLASS=y -# CONFIG_RTC_DRV_EFI is not set -# CONFIG_RTC_DRV_PM8XXX is not set -CONFIG_RTC_I2C_AND_SPI=y -CONFIG_RWSEM_SPIN_ON_OWNER=y -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -# CONFIG_SDM_DISPCC_845 is not set -# CONFIG_SDM_GCC_845 is not set -# CONFIG_SDM_VIDEOCC_845 is not set -# CONFIG_SERIAL_8250 is not set -# CONFIG_SERIAL_AMBA_PL011 is not set -CONFIG_SERIAL_MSM=y -CONFIG_SERIAL_MSM_CONSOLE=y -CONFIG_SGL_ALLOC=y -CONFIG_SMP=y -CONFIG_SND=y -# CONFIG_SND_COMPRESS_OFFLOAD is not set -CONFIG_SND_JACK=y -CONFIG_SND_PCM=y -CONFIG_SND_SOC=y -# CONFIG_SND_SOC_APQ8016_SBC is not set -CONFIG_SND_SOC_I2C_AND_SPI=y -CONFIG_SND_SOC_QCOM=y -# CONFIG_SND_SOC_STORM is not set -CONFIG_SOUND=y -CONFIG_SOUND_OSS_CORE=y -CONFIG_SOUND_OSS_CORE_PRECLAIM=y -CONFIG_SPARSEMEM=y -CONFIG_SPARSEMEM_EXTREME=y -CONFIG_SPARSEMEM_MANUAL=y -CONFIG_SPARSEMEM_VMEMMAP=y -CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y -CONFIG_SPARSE_IRQ=y -CONFIG_SPI=y -CONFIG_SPI_MASTER=y -CONFIG_SPI_MEM=y -CONFIG_SPI_QUP=y -CONFIG_SPI_SPIDEV=y -CONFIG_SPMI=y -CONFIG_SPMI_MSM_PMIC_ARB=y -# CONFIG_SPMI_PMIC_CLKDIV is not set -CONFIG_SRCU=y -CONFIG_STM=y -# CONFIG_STM_SOURCE_HEARTBEAT is not set -# CONFIG_STRIP_ASM_SYMS is not set -CONFIG_SUSPEND=y -CONFIG_SUSPEND_FREEZER=y -# CONFIG_SWAP is not set -CONFIG_SWCONFIG=y -CONFIG_SWIOTLB=y -CONFIG_SWPHY=y -CONFIG_SYSCTL_EXCEPTION_TRACE=y -CONFIG_SYSVIPC_COMPAT=y -CONFIG_SYS_SUPPORTS_HUGETLBFS=y -CONFIG_TASKS_RCU=y -CONFIG_THERMAL=y -CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y -CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 -CONFIG_THERMAL_GOV_STEP_WISE=y -CONFIG_THERMAL_GOV_USER_SPACE=y -CONFIG_THERMAL_OF=y -CONFIG_THERMAL_WRITABLE_TRIPS=y -CONFIG_THREAD_INFO_IN_TASK=y -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_TIMER_OF=y -CONFIG_TIMER_PROBE=y -CONFIG_TREE_SRCU=y -CONFIG_UBIFS_FS=y -CONFIG_UCS2_STRING=y -CONFIG_UEVENT_HELPER_PATH="" -CONFIG_UNINLINE_SPIN_UNLOCK=y -CONFIG_UNMAP_KERNEL_AT_EL0=y -CONFIG_USB_SUPPORT=y -CONFIG_VIRTIO=y -# CONFIG_VIRTIO_BLK is not set -# CONFIG_VIRTIO_CONSOLE is not set -# CONFIG_VIRTIO_NET is not set -CONFIG_VIRTUALIZATION=y -CONFIG_VMAP_STACK=y -CONFIG_VM_EVENT_COUNTERS=y -CONFIG_WANT_DEV_COREDUMP=y -CONFIG_WATCHDOG_CORE=y -# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set -CONFIG_X509_CERTIFICATE_PARSER=y -CONFIG_XPS=y -CONFIG_XZ_DEC_ARM=y -CONFIG_XZ_DEC_BCJ=y -CONFIG_ZLIB_DEFLATE=y -CONFIG_ZLIB_INFLATE=y -CONFIG_ZONE_DMA32=y diff --git a/target/linux/ipq807x/image/Makefile b/target/linux/ipq807x/image/Makefile deleted file mode 100644 index 2a0c74554f..0000000000 --- a/target/linux/ipq807x/image/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/image.mk - -IPQ807X_KERNEL_LOADADDR = 0x41080000 -DEVICE_DTS_CONFIG = "config@hk01" - -define Image/BuildKernel/FIT - gzip -9 -c $(KDIR)/Image > $(KDIR)/Image.gz - $(call CompressLzma,$(KDIR)/Image,$(KDIR)/Image.gz) - $(call Image/BuildKernel/MkFIT,$(1), $(KDIR)/Image.gz, $(DTS_DIR)/qcom/$(1).dtb,gzip,$(2),$(2)) - $(CP) $(KDIR)/fit-$(1).itb $(BIN_DIR)/$(IMG_PREFIX)-$(1)-fit-uImage.itb - mkdir -p $(BIN_DIR)/dtbs/ - $(CP) $(DTS_DIR)/qcom/ipq*.dtb $(BIN_DIR)/dtbs/ - $(CP) $(KDIR)/Image $(BIN_DIR)/dtbs/ -endef - -define Image/BuildKernel/FITInitramfs - $(CP) $(KDIR)/Image-initramfs $(BIN_DIR)/dtbs/ - $(CP) $(KDIR)/Image-initramfs $(BIN_DIR)/$(IMG_PREFIX)-vmlinux-initramfs.bin - $(call Image/BuildKernel/MkFIT,$(1), $(KDIR)/Image-initramfs, $(DTS_DIR)/qcom/$(1).dtb, none,$(2),$(2),-initramfs) - $(CP) $(KDIR)/fit-$(1)-initramfs.itb $(BIN_DIR)/$(IMG_PREFIX)-$(1)-fit-uImage-initramfs.itb -endef - -define Image/Build/squashfs - $(call prepare_generic_squashfs,$(KDIR)/root.squashfs) -endef - -define Image/BuildKernel - $(call Image/BuildKernel/FIT,ipq8074-hk01,$(IPQ807X_KERNEL_LOADADDR)) -endef - -define Image/BuildKernel/Initramfs - $(call Image/BuildKernel/FITInitramfs,ipq8074-hk01,$(IPQ807X_KERNEL_LOADADDR)) -endef - -define Image/Build - $(call Image/Build/$(1),$(1)) -endef - -$(eval $(call BuildImage)) diff --git a/target/linux/ipq807x/profiles/default.mk b/target/linux/ipq807x/profiles/default.mk deleted file mode 100644 index 44935d6905..0000000000 --- a/target/linux/ipq807x/profiles/default.mk +++ /dev/null @@ -1,8 +0,0 @@ -define Profile/Default - NAME:=Default Profile (minimum package set) -endef - -define Profile/Default/Description - Default package set compatible with most boards. -endef -$(eval $(call Profile,Default)) diff --git a/target/linux/kirkwood/patches-5.10/800-power-reset-linkstation-poweroff-prepare-for-new-dev.patch b/target/linux/kirkwood/patches-5.10/800-power-reset-linkstation-poweroff-prepare-for-new-dev.patch index 03253cfe83..4b4d03839a 100644 --- a/target/linux/kirkwood/patches-5.10/800-power-reset-linkstation-poweroff-prepare-for-new-dev.patch +++ b/target/linux/kirkwood/patches-5.10/800-power-reset-linkstation-poweroff-prepare-for-new-dev.patch @@ -15,8 +15,6 @@ Signed-off-by: Pawel Dembicki drivers/power/reset/linkstation-poweroff.c | 35 ++++++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) -diff --git a/drivers/power/reset/linkstation-poweroff.c b/drivers/power/reset/linkstation-poweroff.c -index f1e843df0e16..8691cf98600d 100644 --- a/drivers/power/reset/linkstation-poweroff.c +++ b/drivers/power/reset/linkstation-poweroff.c @@ -29,11 +29,21 @@ @@ -42,7 +40,7 @@ index f1e843df0e16..8691cf98600d 100644 saved_page = phy_select_page(phydev, MII_MARVELL_LED_PAGE); if (saved_page < 0) -@@ -66,11 +76,16 @@ static void mvphy_reg_intn(u16 data) +@@ -66,11 +76,16 @@ err: dev_err(&phydev->mdio.dev, "Write register failed, %d\n", rc); } @@ -60,7 +58,7 @@ index f1e843df0e16..8691cf98600d 100644 return NOTIFY_DONE; } -@@ -82,14 +97,18 @@ static struct notifier_block linkstation_reboot_nb = { +@@ -82,14 +97,18 @@ static struct notifier_block linkstation static void linkstation_poweroff(void) { unregister_reboot_notifier(&linkstation_reboot_nb); @@ -82,7 +80,7 @@ index f1e843df0e16..8691cf98600d 100644 { }, }; -@@ -97,13 +116,17 @@ static int __init linkstation_poweroff_init(void) +@@ -97,13 +116,17 @@ static int __init linkstation_poweroff_i { struct mii_bus *bus; struct device_node *dn; @@ -101,6 +99,3 @@ index f1e843df0e16..8691cf98600d 100644 if (!dn) return -ENODEV; --- -2.25.1 - diff --git a/target/linux/kirkwood/patches-5.10/801-power-reset-linkstation-poweroff-add-new-device.patch b/target/linux/kirkwood/patches-5.10/801-power-reset-linkstation-poweroff-add-new-device.patch index 0b3b4ad2d7..a929aacfd0 100644 --- a/target/linux/kirkwood/patches-5.10/801-power-reset-linkstation-poweroff-add-new-device.patch +++ b/target/linux/kirkwood/patches-5.10/801-power-reset-linkstation-poweroff-add-new-device.patch @@ -17,8 +17,6 @@ Signed-off-by: Pawel Dembicki drivers/power/reset/linkstation-poweroff.c | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) -diff --git a/drivers/power/reset/linkstation-poweroff.c b/drivers/power/reset/linkstation-poweroff.c -index 8691cf98600d..2a92b6052cac 100644 --- a/drivers/power/reset/linkstation-poweroff.c +++ b/drivers/power/reset/linkstation-poweroff.c @@ -19,6 +19,7 @@ @@ -38,7 +36,7 @@ index 8691cf98600d..2a92b6052cac 100644 struct power_off_cfg { char *mdio_node_name; void (*phy_set_reg)(bool restart); -@@ -76,11 +79,48 @@ static void linkstation_mvphy_reg_intn(bool restart) +@@ -76,11 +79,48 @@ err: dev_err(&phydev->mdio.dev, "Write register failed, %d\n", rc); } @@ -87,7 +85,7 @@ index 8691cf98600d..2a92b6052cac 100644 static int linkstation_reboot_notifier(struct notifier_block *nb, unsigned long action, void *unused) { -@@ -109,6 +149,9 @@ static const struct of_device_id ls_poweroff_of_match[] = { +@@ -109,6 +149,9 @@ static const struct of_device_id ls_powe { .compatible = "buffalo,ls421de", .data = &linkstation_power_off_cfg, }, @@ -97,6 +95,3 @@ index 8691cf98600d..2a92b6052cac 100644 { }, }; --- -2.25.1 - diff --git a/target/linux/kirkwood/patches-5.4/800-power-reset-linkstation-poweroff-prepare-for-new-dev.patch b/target/linux/kirkwood/patches-5.4/800-power-reset-linkstation-poweroff-prepare-for-new-dev.patch index 03253cfe83..4b4d03839a 100644 --- a/target/linux/kirkwood/patches-5.4/800-power-reset-linkstation-poweroff-prepare-for-new-dev.patch +++ b/target/linux/kirkwood/patches-5.4/800-power-reset-linkstation-poweroff-prepare-for-new-dev.patch @@ -15,8 +15,6 @@ Signed-off-by: Pawel Dembicki drivers/power/reset/linkstation-poweroff.c | 35 ++++++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) -diff --git a/drivers/power/reset/linkstation-poweroff.c b/drivers/power/reset/linkstation-poweroff.c -index f1e843df0e16..8691cf98600d 100644 --- a/drivers/power/reset/linkstation-poweroff.c +++ b/drivers/power/reset/linkstation-poweroff.c @@ -29,11 +29,21 @@ @@ -42,7 +40,7 @@ index f1e843df0e16..8691cf98600d 100644 saved_page = phy_select_page(phydev, MII_MARVELL_LED_PAGE); if (saved_page < 0) -@@ -66,11 +76,16 @@ static void mvphy_reg_intn(u16 data) +@@ -66,11 +76,16 @@ err: dev_err(&phydev->mdio.dev, "Write register failed, %d\n", rc); } @@ -60,7 +58,7 @@ index f1e843df0e16..8691cf98600d 100644 return NOTIFY_DONE; } -@@ -82,14 +97,18 @@ static struct notifier_block linkstation_reboot_nb = { +@@ -82,14 +97,18 @@ static struct notifier_block linkstation static void linkstation_poweroff(void) { unregister_reboot_notifier(&linkstation_reboot_nb); @@ -82,7 +80,7 @@ index f1e843df0e16..8691cf98600d 100644 { }, }; -@@ -97,13 +116,17 @@ static int __init linkstation_poweroff_init(void) +@@ -97,13 +116,17 @@ static int __init linkstation_poweroff_i { struct mii_bus *bus; struct device_node *dn; @@ -101,6 +99,3 @@ index f1e843df0e16..8691cf98600d 100644 if (!dn) return -ENODEV; --- -2.25.1 - diff --git a/target/linux/kirkwood/patches-5.4/801-power-reset-linkstation-poweroff-add-new-device.patch b/target/linux/kirkwood/patches-5.4/801-power-reset-linkstation-poweroff-add-new-device.patch index 0b3b4ad2d7..a929aacfd0 100644 --- a/target/linux/kirkwood/patches-5.4/801-power-reset-linkstation-poweroff-add-new-device.patch +++ b/target/linux/kirkwood/patches-5.4/801-power-reset-linkstation-poweroff-add-new-device.patch @@ -17,8 +17,6 @@ Signed-off-by: Pawel Dembicki drivers/power/reset/linkstation-poweroff.c | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) -diff --git a/drivers/power/reset/linkstation-poweroff.c b/drivers/power/reset/linkstation-poweroff.c -index 8691cf98600d..2a92b6052cac 100644 --- a/drivers/power/reset/linkstation-poweroff.c +++ b/drivers/power/reset/linkstation-poweroff.c @@ -19,6 +19,7 @@ @@ -38,7 +36,7 @@ index 8691cf98600d..2a92b6052cac 100644 struct power_off_cfg { char *mdio_node_name; void (*phy_set_reg)(bool restart); -@@ -76,11 +79,48 @@ static void linkstation_mvphy_reg_intn(bool restart) +@@ -76,11 +79,48 @@ err: dev_err(&phydev->mdio.dev, "Write register failed, %d\n", rc); } @@ -87,7 +85,7 @@ index 8691cf98600d..2a92b6052cac 100644 static int linkstation_reboot_notifier(struct notifier_block *nb, unsigned long action, void *unused) { -@@ -109,6 +149,9 @@ static const struct of_device_id ls_poweroff_of_match[] = { +@@ -109,6 +149,9 @@ static const struct of_device_id ls_powe { .compatible = "buffalo,ls421de", .data = &linkstation_power_off_cfg, }, @@ -97,6 +95,3 @@ index 8691cf98600d..2a92b6052cac 100644 { }, }; --- -2.25.1 - diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi index e379b07b53..27858be28f 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi @@ -488,8 +488,6 @@ interrupt-names = "tx", "rx"; resets = <&reset0 21 16>, <&reset0 8 8>, <&reset0 3 3>; reset-names = "switch", "ppe", "ppe_dsp"; - lantiq,tx-burst-length = <8>; - lantiq,rx-burst-length = <8>; #address-cells = <1>; #size-cells = <0>; diff --git a/target/linux/lantiq/patches-5.10/0113-MIPS-lantiq-dma-make-a-burst-length-configurable-in-.patch b/target/linux/lantiq/patches-5.10/0310-v5.16-MIPS-lantiq-dma-make-the-burst-length-configurable-b.patch similarity index 86% rename from target/linux/lantiq/patches-5.10/0113-MIPS-lantiq-dma-make-a-burst-length-configurable-in-.patch rename to target/linux/lantiq/patches-5.10/0310-v5.16-MIPS-lantiq-dma-make-the-burst-length-configurable-b.patch index fab2440453..33c06e9d77 100644 --- a/target/linux/lantiq/patches-5.10/0113-MIPS-lantiq-dma-make-a-burst-length-configurable-in-.patch +++ b/target/linux/lantiq/patches-5.10/0310-v5.16-MIPS-lantiq-dma-make-the-burst-length-configurable-b.patch @@ -1,12 +1,14 @@ -From 6615eeb39f7a110a196f20acbfb3a017da4d75d2 Mon Sep 17 00:00:00 2001 +From 49293bbc50cb7d44223eb49e0f7cb38e7dac2361 Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski -Date: Fri, 14 May 2021 21:25:08 +0200 -Subject: [PATCH 4/5] MIPS: lantiq: dma: make a burst length configurable in - drivers +Date: Tue, 14 Sep 2021 23:21:01 +0200 +Subject: [PATCH 4/5] MIPS: lantiq: dma: make the burst length configurable by + the drivers -Make a burst length configurable in drivers. +Make the burst length configurable by the drivers. Signed-off-by: Aleksander Jan Bajkowski +Acked-by: Hauke Mehrtens +Signed-off-by: David S. Miller --- .../include/asm/mach-lantiq/xway/xway_dma.h | 2 +- arch/mips/lantiq/xway/dma.c | 38 ++++++++++++++++--- diff --git a/target/linux/lantiq/patches-5.10/0710-net-lantiq-configure-burst-length-for-ethernet.patch b/target/linux/lantiq/patches-5.10/0710-v5.16-net-lantiq-configure-the-burst-length-in-ethernet-dr.patch similarity index 86% rename from target/linux/lantiq/patches-5.10/0710-net-lantiq-configure-burst-length-for-ethernet.patch rename to target/linux/lantiq/patches-5.10/0710-v5.16-net-lantiq-configure-the-burst-length-in-ethernet-dr.patch index 0a2996813a..bf3b903616 100644 --- a/target/linux/lantiq/patches-5.10/0710-net-lantiq-configure-burst-length-for-ethernet.patch +++ b/target/linux/lantiq/patches-5.10/0710-v5.16-net-lantiq-configure-the-burst-length-in-ethernet-dr.patch @@ -1,11 +1,12 @@ -From ec1a17a11aced3cd756e59d91ad6f50b7a2fabfb Mon Sep 17 00:00:00 2001 +From 14d4e308e0aa0b78dc7a059716861a4380de3535 Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski -Date: Sun, 16 May 2021 15:52:06 +0200 -Subject: [PATCH 5/5] net: lantiq: configure burst length for ethernet +Date: Tue, 14 Sep 2021 23:21:02 +0200 +Subject: [PATCH 5/5] net: lantiq: configure the burst length in ethernet + drivers -Configure the burst length for Ethernet. This improves Ethernet -performance by 58%. According to the vendor BSP, 8W burst length -is supported by ar9 and newer SoCs. +Configure the burst length in Ethernet drivers. This improves +Ethernet performance by 58%. According to the vendor BSP, +8W burst length is supported by ar9 and newer SoCs. The NAT benchmark results on xRX200 (Down/Up): * 2W: 330 Mb/s @@ -15,6 +16,7 @@ The NAT benchmark results on xRX200 (Down/Up): Tested on xRX200 and xRX330. Signed-off-by: Aleksander Jan Bajkowski +Signed-off-by: David S. Miller --- drivers/net/ethernet/lantiq_etop.c | 21 ++++++++++++++++++--- drivers/net/ethernet/lantiq_xrx200.c | 21 ++++++++++++++++++--- @@ -37,7 +39,7 @@ Signed-off-by: Aleksander Jan Bajkowski int err; - ltq_dma_init_port(DMA_PORT_ETOP); -+ ltq_dma_init_port(DMA_PORT_ETOP, priv->tx_burst_len, priv->rx_burst_len); ++ ltq_dma_init_port(DMA_PORT_ETOP, priv->tx_burst_len, rx_burst_len); priv->txch.dma.nr = tx; priv->txch.dma.dev = &priv->pdev->dev; @@ -99,7 +101,7 @@ Signed-off-by: Aleksander Jan Bajkowski int i; - ltq_dma_init_port(DMA_PORT_ETOP); -+ ltq_dma_init_port(DMA_PORT_ETOP, priv->tx_burst_len, priv->rx_burst_len); ++ ltq_dma_init_port(DMA_PORT_ETOP, priv->tx_burst_len, rx_burst_len); ch_rx->dma.nr = XRX200_DMA_RX; ch_rx->dma.dev = priv->dev; diff --git a/target/linux/lantiq/patches-5.10/0711-v5.16-net-lantiq_xrx200-Hardcode-the-burst-length-value.patch b/target/linux/lantiq/patches-5.10/0711-v5.16-net-lantiq_xrx200-Hardcode-the-burst-length-value.patch new file mode 100644 index 0000000000..0b68179a48 --- /dev/null +++ b/target/linux/lantiq/patches-5.10/0711-v5.16-net-lantiq_xrx200-Hardcode-the-burst-length-value.patch @@ -0,0 +1,73 @@ +From 7e553c44f09a8f536090904c6db5b8c9dbafa03b Mon Sep 17 00:00:00 2001 +From: Aleksander Jan Bajkowski +Date: Tue, 26 Oct 2021 22:59:01 +0200 +Subject: [PATCH] net: lantiq_xrx200: Hardcode the burst length value + +All SoCs with this IP core support 8 burst length. Hauke +suggested to hardcode this value and simplify the driver. + +Link: https://lkml.org/lkml/2021/9/14/1533 +Signed-off-by: Aleksander Jan Bajkowski +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/lantiq_xrx200.c | 21 ++++----------------- + 1 file changed, 4 insertions(+), 17 deletions(-) + +--- a/drivers/net/ethernet/lantiq_xrx200.c ++++ b/drivers/net/ethernet/lantiq_xrx200.c +@@ -23,6 +23,7 @@ + #define XRX200_DMA_DATA_LEN 0x600 + #define XRX200_DMA_RX 0 + #define XRX200_DMA_TX 1 ++#define XRX200_DMA_BURST_LEN 8 + + /* cpu port mac */ + #define PMAC_RX_IPG 0x0024 +@@ -71,9 +72,6 @@ struct xrx200_priv { + struct net_device *net_dev; + struct device *dev; + +- int tx_burst_len; +- int rx_burst_len; +- + __iomem void *pmac_reg; + }; + +@@ -320,7 +318,7 @@ static netdev_tx_t xrx200_start_xmit(str + goto err_drop; + + /* dma needs to start on a burst length value aligned address */ +- byte_offset = mapping % (priv->tx_burst_len * 4); ++ byte_offset = mapping % (XRX200_DMA_BURST_LEN * 4); + + desc->addr = mapping - byte_offset; + /* Make sure the address is written before we give it to HW */ +@@ -372,7 +370,8 @@ static int xrx200_dma_init(struct xrx200 + int ret = 0; + int i; + +- ltq_dma_init_port(DMA_PORT_ETOP, priv->tx_burst_len, rx_burst_len); ++ ltq_dma_init_port(DMA_PORT_ETOP, XRX200_DMA_BURST_LEN, ++ XRX200_DMA_BURST_LEN); + + ch_rx->dma.nr = XRX200_DMA_RX; + ch_rx->dma.dev = priv->dev; +@@ -490,18 +489,6 @@ static int xrx200_probe(struct platform_ + if (err) + eth_hw_addr_random(net_dev); + +- err = device_property_read_u32(dev, "lantiq,tx-burst-length", &priv->tx_burst_len); +- if (err < 0) { +- dev_err(dev, "unable to read tx-burst-length property\n"); +- return err; +- } +- +- err = device_property_read_u32(dev, "lantiq,rx-burst-length", &priv->rx_burst_len); +- if (err < 0) { +- dev_err(dev, "unable to read rx-burst-length property\n"); +- return err; +- } +- + /* bring up the dma engine and IP core */ + err = xrx200_dma_init(priv); + if (err) diff --git a/target/linux/lantiq/patches-5.10/0712-v5.16-net-ethernet-lantiq_etop-Fix-compilation-error.patch b/target/linux/lantiq/patches-5.10/0712-v5.16-net-ethernet-lantiq_etop-Fix-compilation-error.patch new file mode 100644 index 0000000000..06f4bc2eee --- /dev/null +++ b/target/linux/lantiq/patches-5.10/0712-v5.16-net-ethernet-lantiq_etop-Fix-compilation-error.patch @@ -0,0 +1,26 @@ +From 68eabc348148ae051631e8dab13c3b1a85c82896 Mon Sep 17 00:00:00 2001 +From: Aleksander Jan Bajkowski +Date: Tue, 9 Nov 2021 23:23:54 +0100 +Subject: [PATCH] net: ethernet: lantiq_etop: Fix compilation error + +This fixes the error detected when compiling the driver. + +Fixes: 14d4e308e0aa ("net: lantiq: configure the burst length in ethernet drivers") +Reported-by: kernel test robot +Signed-off-by: Aleksander Jan Bajkowski +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/lantiq_etop.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/ethernet/lantiq_etop.c ++++ b/drivers/net/ethernet/lantiq_etop.c +@@ -402,7 +402,7 @@ ltq_etop_dma_init(struct net_device *dev + int rx = priv->rx_irq - LTQ_DMA_ETOP; + int err; + +- ltq_dma_init_port(DMA_PORT_ETOP, priv->tx_burst_len, rx_burst_len); ++ ltq_dma_init_port(DMA_PORT_ETOP, priv->tx_burst_len, priv->rx_burst_len); + + priv->txch.dma.nr = tx; + priv->txch.dma.dev = &priv->pdev->dev; diff --git a/target/linux/mediatek/dts/mt7623a-unielec-u7623-02-emmc.dtsi b/target/linux/mediatek/dts/mt7623a-unielec-u7623-02-emmc.dtsi index aa1e82b58a..0a2972e23b 100644 --- a/target/linux/mediatek/dts/mt7623a-unielec-u7623-02-emmc.dtsi +++ b/target/linux/mediatek/dts/mt7623a-unielec-u7623-02-emmc.dtsi @@ -298,6 +298,10 @@ }; }; +&mt6323keys { + mediatek,long-press-mode = <0>; +}; + &uart2 { pinctrl-names = "default"; pinctrl-0 = <&uart2_pins_b>; diff --git a/target/linux/mediatek/mt7623/config-5.10 b/target/linux/mediatek/mt7623/config-5.10 index 60e2aa87bd..054c724255 100644 --- a/target/linux/mediatek/mt7623/config-5.10 +++ b/target/linux/mediatek/mt7623/config-5.10 @@ -260,6 +260,7 @@ CONFIG_HARDIRQS_SW_RESEND=y CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT_MAP=y +CONFIG_HAVE_ARM_ARCH_TIMER=y CONFIG_HAVE_SMP=y CONFIG_HDMI=y CONFIG_HID=y diff --git a/target/linux/mediatek/patches-5.10/701-net-ethernet-mtk_eth_soc-fix-return-value-of-MDIO-ops.patch b/target/linux/mediatek/patches-5.10/701-net-ethernet-mtk_eth_soc-fix-return-value-of-MDIO-ops.patch deleted file mode 100644 index 696b68df47..0000000000 --- a/target/linux/mediatek/patches-5.10/701-net-ethernet-mtk_eth_soc-fix-return-value-of-MDIO-ops.patch +++ /dev/null @@ -1,97 +0,0 @@ -From patchwork Mon Dec 27 18:31:09 2021 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Daniel Golle -X-Patchwork-Id: 12699993 -X-Patchwork-Delegate: kuba@kernel.org -Return-Path: -Date: Mon, 27 Dec 2021 18:31:09 +0000 -From: Daniel Golle -To: linux-mediatek@lists.infradead.org, netdev@vger.kernel.org, - linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org -Cc: Felix Fietkau , John Crispin , - Sean Wang , - Mark Lee , - "David S. Miller" , - Jakub Kicinski , - Matthias Brugger , - Russell King , - Andrew Lunn -Subject: [PATCH v5 1/2] net: ethernet: mtk_eth_soc: fix return value of MDIO - ops -Message-ID: -References: - -MIME-Version: 1.0 -Content-Disposition: inline -In-Reply-To: - -Precedence: bulk -List-ID: -X-Mailing-List: netdev@vger.kernel.org -X-Patchwork-Delegate: kuba@kernel.org - -Instead of returning -1 (-EPERM) when MDIO bus is stuck busy -while writing or 0xffff if it happens while reading, return the -appropriate -EBUSY. Also fix return type to int instead of u32. - -Fixes: 656e705243fd0 ("net-next: mediatek: add support for MT7623 ethernet") -Signed-off-by: Daniel Golle ---- -v5: fix incomplete unification of variable names phy_reg vs. phy_register -v4: clean-up return values and types, split into two commits - - drivers/net/ethernet/mediatek/mtk_eth_soc.c | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - ---- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c -+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -95,31 +95,31 @@ static int mtk_mdio_busy_wait(struct mtk - return -1; - } - --static u32 _mtk_mdio_write(struct mtk_eth *eth, u32 phy_addr, -- u32 phy_register, u32 write_data) -+static int _mtk_mdio_write(struct mtk_eth *eth, u32 phy_addr, u32 phy_reg, -+ u32 write_data) - { - if (mtk_mdio_busy_wait(eth)) -- return -1; -+ return -EBUSY; - - write_data &= 0xffff; - - mtk_w32(eth, PHY_IAC_ACCESS | PHY_IAC_START | PHY_IAC_WRITE | -- (phy_register << PHY_IAC_REG_SHIFT) | -+ (phy_reg << PHY_IAC_REG_SHIFT) | - (phy_addr << PHY_IAC_ADDR_SHIFT) | write_data, - MTK_PHY_IAC); - - if (mtk_mdio_busy_wait(eth)) -- return -1; -+ return -EBUSY; - - return 0; - } - --static u32 _mtk_mdio_read(struct mtk_eth *eth, int phy_addr, int phy_reg) -+static int _mtk_mdio_read(struct mtk_eth *eth, int phy_addr, int phy_reg) - { - u32 d; - - if (mtk_mdio_busy_wait(eth)) -- return 0xffff; -+ return -EBUSY; - - mtk_w32(eth, PHY_IAC_ACCESS | PHY_IAC_START | PHY_IAC_READ | - (phy_reg << PHY_IAC_REG_SHIFT) | -@@ -127,7 +127,7 @@ static u32 _mtk_mdio_read(struct mtk_eth - MTK_PHY_IAC); - - if (mtk_mdio_busy_wait(eth)) -- return 0xffff; -+ return -EBUSY; - - d = mtk_r32(eth, MTK_PHY_IAC) & 0xffff; - diff --git a/target/linux/mediatek/patches-5.10/701-v5.17-net-ethernet-mtk_eth_soc-fix-return-values-and-refac.patch b/target/linux/mediatek/patches-5.10/701-v5.17-net-ethernet-mtk_eth_soc-fix-return-values-and-refac.patch new file mode 100644 index 0000000000..5da46f07e0 --- /dev/null +++ b/target/linux/mediatek/patches-5.10/701-v5.17-net-ethernet-mtk_eth_soc-fix-return-values-and-refac.patch @@ -0,0 +1,128 @@ +From eda80b249df7bbc7b3dd13907343a3e59bfc57fd Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Tue, 4 Jan 2022 12:06:22 +0000 +Subject: [PATCH 1/3] net: ethernet: mtk_eth_soc: fix return values and + refactor MDIO ops + +Instead of returning -1 (-EPERM) when MDIO bus is stuck busy +while writing or 0xffff if it happens while reading, return the +appropriate -ETIMEDOUT. Also fix return type to int instead of u32. +Refactor functions to use bitfield helpers instead of having various +masking and shifting constants in the code, which also results in the +register definitions in the header file being more obviously related +to what is stated in the MediaTek's Reference Manual. + +Fixes: 656e705243fd0 ("net-next: mediatek: add support for MT7623 ethernet") +Signed-off-by: Daniel Golle +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 53 ++++++++++++--------- + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 16 +++++-- + 2 files changed, 41 insertions(+), 28 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -92,46 +92,53 @@ static int mtk_mdio_busy_wait(struct mtk + } + + dev_err(eth->dev, "mdio: MDIO timeout\n"); +- return -1; ++ return -ETIMEDOUT; + } + +-static u32 _mtk_mdio_write(struct mtk_eth *eth, u32 phy_addr, +- u32 phy_register, u32 write_data) ++static int _mtk_mdio_write(struct mtk_eth *eth, u32 phy_addr, u32 phy_reg, ++ u32 write_data) + { +- if (mtk_mdio_busy_wait(eth)) +- return -1; ++ int ret; + +- write_data &= 0xffff; +- +- mtk_w32(eth, PHY_IAC_ACCESS | PHY_IAC_START | PHY_IAC_WRITE | +- (phy_register << PHY_IAC_REG_SHIFT) | +- (phy_addr << PHY_IAC_ADDR_SHIFT) | write_data, ++ ret = mtk_mdio_busy_wait(eth); ++ if (ret < 0) ++ return ret; ++ ++ mtk_w32(eth, PHY_IAC_ACCESS | ++ PHY_IAC_START_C22 | ++ PHY_IAC_CMD_WRITE | ++ PHY_IAC_REG(phy_reg) | ++ PHY_IAC_ADDR(phy_addr) | ++ PHY_IAC_DATA(write_data), + MTK_PHY_IAC); + +- if (mtk_mdio_busy_wait(eth)) +- return -1; ++ ret = mtk_mdio_busy_wait(eth); ++ if (ret < 0) ++ return ret; + + return 0; + } + +-static u32 _mtk_mdio_read(struct mtk_eth *eth, int phy_addr, int phy_reg) ++static int _mtk_mdio_read(struct mtk_eth *eth, u32 phy_addr, u32 phy_reg) + { +- u32 d; +- +- if (mtk_mdio_busy_wait(eth)) +- return 0xffff; ++ int ret; + +- mtk_w32(eth, PHY_IAC_ACCESS | PHY_IAC_START | PHY_IAC_READ | +- (phy_reg << PHY_IAC_REG_SHIFT) | +- (phy_addr << PHY_IAC_ADDR_SHIFT), ++ ret = mtk_mdio_busy_wait(eth); ++ if (ret < 0) ++ return ret; ++ ++ mtk_w32(eth, PHY_IAC_ACCESS | ++ PHY_IAC_START_C22 | ++ PHY_IAC_CMD_C22_READ | ++ PHY_IAC_REG(phy_reg) | ++ PHY_IAC_ADDR(phy_addr), + MTK_PHY_IAC); + +- if (mtk_mdio_busy_wait(eth)) +- return 0xffff; +- +- d = mtk_r32(eth, MTK_PHY_IAC) & 0xffff; ++ ret = mtk_mdio_busy_wait(eth); ++ if (ret < 0) ++ return ret; + +- return d; ++ return mtk_r32(eth, MTK_PHY_IAC) & PHY_IAC_DATA_MASK; + } + + static int mtk_mdio_write(struct mii_bus *bus, int phy_addr, +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -340,11 +340,17 @@ + /* PHY Indirect Access Control registers */ + #define MTK_PHY_IAC 0x10004 + #define PHY_IAC_ACCESS BIT(31) +-#define PHY_IAC_READ BIT(19) +-#define PHY_IAC_WRITE BIT(18) +-#define PHY_IAC_START BIT(16) +-#define PHY_IAC_ADDR_SHIFT 20 +-#define PHY_IAC_REG_SHIFT 25 ++#define PHY_IAC_REG_MASK GENMASK(29, 25) ++#define PHY_IAC_REG(x) FIELD_PREP(PHY_IAC_REG_MASK, (x)) ++#define PHY_IAC_ADDR_MASK GENMASK(24, 20) ++#define PHY_IAC_ADDR(x) FIELD_PREP(PHY_IAC_ADDR_MASK, (x)) ++#define PHY_IAC_CMD_MASK GENMASK(19, 18) ++#define PHY_IAC_CMD_WRITE FIELD_PREP(PHY_IAC_CMD_MASK, 1) ++#define PHY_IAC_CMD_C22_READ FIELD_PREP(PHY_IAC_CMD_MASK, 2) ++#define PHY_IAC_START_MASK GENMASK(17, 16) ++#define PHY_IAC_START_C22 FIELD_PREP(PHY_IAC_START_MASK, 1) ++#define PHY_IAC_DATA_MASK GENMASK(15, 0) ++#define PHY_IAC_DATA(x) FIELD_PREP(PHY_IAC_DATA_MASK, (x)) + #define PHY_IAC_TIMEOUT HZ + + #define MTK_MAC_MISC 0x1000c diff --git a/target/linux/mediatek/patches-5.10/702-net-ethernet-mtk_eth_soc-implement-Clause-45-MDIO-access.patch b/target/linux/mediatek/patches-5.10/702-net-ethernet-mtk_eth_soc-implement-Clause-45-MDIO-access.patch deleted file mode 100644 index f7732cae9b..0000000000 --- a/target/linux/mediatek/patches-5.10/702-net-ethernet-mtk_eth_soc-implement-Clause-45-MDIO-access.patch +++ /dev/null @@ -1,157 +0,0 @@ -From patchwork Mon Dec 27 18:31:43 2021 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Daniel Golle -X-Patchwork-Id: 12699994 -X-Patchwork-Delegate: kuba@kernel.org -Return-Path: -Date: Mon, 27 Dec 2021 18:31:43 +0000 -From: Daniel Golle -To: linux-mediatek@lists.infradead.org, netdev@vger.kernel.org, - linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org -Cc: Felix Fietkau , John Crispin , - Sean Wang , - Mark Lee , - "David S. Miller" , - Jakub Kicinski , - Matthias Brugger , - Russell King , - Andrew Lunn -Subject: [PATCH v5 2/2] net: ethernet: mtk_eth_soc: implement Clause 45 MDIO - access -Message-ID: -References: - -MIME-Version: 1.0 -Content-Disposition: inline -In-Reply-To: - -Precedence: bulk -List-ID: -X-Mailing-List: netdev@vger.kernel.org -X-Patchwork-Delegate: kuba@kernel.org - -Implement read and write access to IEEE 802.3 Clause 45 Ethernet -phy registers. -Tested on the Ubiquiti UniFi 6 LR access point featuring -MediaTek MT7622BV WiSoC with Aquantia AQR112C. - -Signed-off-by: Daniel Golle ---- -v5: unchanged -v4: clean-up return values and types, split into two commits -v3: return -1 instead of 0xffff on error in _mtk_mdio_write -v2: use MII_DEVADDR_C45_SHIFT and MII_REGADDR_C45_MASK to extract - device id and register address. Unify read and write functions to - have identical types and parameter names where possible as we are - anyway already replacing both function bodies. - - - drivers/net/ethernet/mediatek/mtk_eth_soc.c | 60 +++++++++++++++++---- - drivers/net/ethernet/mediatek/mtk_eth_soc.h | 3 ++ - 2 files changed, 53 insertions(+), 10 deletions(-) - ---- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c -+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -103,10 +103,30 @@ static int _mtk_mdio_write(struct mtk_et - - write_data &= 0xffff; - -- mtk_w32(eth, PHY_IAC_ACCESS | PHY_IAC_START | PHY_IAC_WRITE | -- (phy_reg << PHY_IAC_REG_SHIFT) | -- (phy_addr << PHY_IAC_ADDR_SHIFT) | write_data, -- MTK_PHY_IAC); -+ if (phy_reg & MII_ADDR_C45) { -+ u8 dev_num = (phy_reg >> MII_DEVADDR_C45_SHIFT) & GENMASK(4, 0); -+ u16 reg = (u16)(phy_reg & MII_REGADDR_C45_MASK); -+ -+ mtk_w32(eth, PHY_IAC_ACCESS | PHY_IAC_START_C45 | PHY_IAC_SET_ADDR | -+ (phy_addr << PHY_IAC_ADDR_SHIFT) | -+ (dev_num << PHY_IAC_REG_SHIFT) | -+ reg, -+ MTK_PHY_IAC); -+ -+ if (mtk_mdio_busy_wait(eth)) -+ return -EBUSY; -+ -+ mtk_w32(eth, PHY_IAC_ACCESS | PHY_IAC_START_C45 | PHY_IAC_WRITE | -+ (phy_addr << PHY_IAC_ADDR_SHIFT) | -+ (dev_num << PHY_IAC_REG_SHIFT) | -+ write_data, -+ MTK_PHY_IAC); -+ } else { -+ mtk_w32(eth, PHY_IAC_ACCESS | PHY_IAC_START | PHY_IAC_WRITE | -+ (phy_reg << PHY_IAC_REG_SHIFT) | -+ (phy_addr << PHY_IAC_ADDR_SHIFT) | write_data, -+ MTK_PHY_IAC); -+ } - - if (mtk_mdio_busy_wait(eth)) - return -EBUSY; -@@ -114,17 +134,36 @@ static int _mtk_mdio_write(struct mtk_et - return 0; - } - --static int _mtk_mdio_read(struct mtk_eth *eth, int phy_addr, int phy_reg) -+static int _mtk_mdio_read(struct mtk_eth *eth, u32 phy_addr, u32 phy_reg) - { -- u32 d; -+ int d; - - if (mtk_mdio_busy_wait(eth)) - return -EBUSY; - -- mtk_w32(eth, PHY_IAC_ACCESS | PHY_IAC_START | PHY_IAC_READ | -- (phy_reg << PHY_IAC_REG_SHIFT) | -- (phy_addr << PHY_IAC_ADDR_SHIFT), -- MTK_PHY_IAC); -+ if (phy_reg & MII_ADDR_C45) { -+ u8 dev_num = (phy_reg >> MII_DEVADDR_C45_SHIFT) & GENMASK(4, 0); -+ u16 reg = (u16)(phy_reg & MII_REGADDR_C45_MASK); -+ -+ mtk_w32(eth, PHY_IAC_ACCESS | PHY_IAC_START_C45 | PHY_IAC_SET_ADDR | -+ (phy_addr << PHY_IAC_ADDR_SHIFT) | -+ (dev_num << PHY_IAC_REG_SHIFT) | -+ reg, -+ MTK_PHY_IAC); -+ -+ if (mtk_mdio_busy_wait(eth)) -+ return -EBUSY; -+ -+ mtk_w32(eth, PHY_IAC_ACCESS | PHY_IAC_START_C45 | PHY_IAC_READ_C45 | -+ (phy_addr << PHY_IAC_ADDR_SHIFT) | -+ (dev_num << PHY_IAC_REG_SHIFT), -+ MTK_PHY_IAC); -+ } else { -+ mtk_w32(eth, PHY_IAC_ACCESS | PHY_IAC_START | PHY_IAC_READ | -+ (phy_reg << PHY_IAC_REG_SHIFT) | -+ (phy_addr << PHY_IAC_ADDR_SHIFT), -+ MTK_PHY_IAC); -+ } - - if (mtk_mdio_busy_wait(eth)) - return -EBUSY; -@@ -584,6 +623,7 @@ static int mtk_mdio_init(struct mtk_eth - eth->mii_bus->name = "mdio"; - eth->mii_bus->read = mtk_mdio_read; - eth->mii_bus->write = mtk_mdio_write; -+ eth->mii_bus->probe_capabilities = MDIOBUS_C22_C45; - eth->mii_bus->priv = eth; - eth->mii_bus->parent = eth->dev; - ---- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h -+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -340,9 +340,12 @@ - /* PHY Indirect Access Control registers */ - #define MTK_PHY_IAC 0x10004 - #define PHY_IAC_ACCESS BIT(31) -+#define PHY_IAC_SET_ADDR 0 - #define PHY_IAC_READ BIT(19) -+#define PHY_IAC_READ_C45 (BIT(18) | BIT(19)) - #define PHY_IAC_WRITE BIT(18) - #define PHY_IAC_START BIT(16) -+#define PHY_IAC_START_C45 0 - #define PHY_IAC_ADDR_SHIFT 20 - #define PHY_IAC_REG_SHIFT 25 - #define PHY_IAC_TIMEOUT HZ diff --git a/target/linux/mediatek/patches-5.10/702-v5.17-net-mdio-add-helpers-to-extract-clause-45-regad-and-.patch b/target/linux/mediatek/patches-5.10/702-v5.17-net-mdio-add-helpers-to-extract-clause-45-regad-and-.patch new file mode 100644 index 0000000000..ef2e225717 --- /dev/null +++ b/target/linux/mediatek/patches-5.10/702-v5.17-net-mdio-add-helpers-to-extract-clause-45-regad-and-.patch @@ -0,0 +1,53 @@ +From c6af53f038aa32cec12e8a305ba07c7ef168f1b0 Mon Sep 17 00:00:00 2001 +From: "Russell King (Oracle)" +Date: Tue, 4 Jan 2022 12:07:00 +0000 +Subject: [PATCH 2/3] net: mdio: add helpers to extract clause 45 regad and + devad fields + +Add a couple of helpers and definitions to extract the clause 45 regad +and devad fields from the regnum passed into MDIO drivers. + +Tested-by: Daniel Golle +Reviewed-by: Andrew Lunn +Signed-off-by: Russell King (Oracle) +Signed-off-by: Daniel Golle +Signed-off-by: David S. Miller +--- + include/linux/mdio.h | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +--- a/include/linux/mdio.h ++++ b/include/linux/mdio.h +@@ -7,6 +7,7 @@ + #define __LINUX_MDIO_H__ + + #include ++#include + #include + + /* Or MII_ADDR_C45 into regnum for read/write on mii_bus to enable the 21 bit +@@ -14,6 +15,7 @@ + */ + #define MII_ADDR_C45 (1<<30) + #define MII_DEVADDR_C45_SHIFT 16 ++#define MII_DEVADDR_C45_MASK GENMASK(20, 16) + #define MII_REGADDR_C45_MASK GENMASK(15, 0) + + struct gpio_desc; +@@ -342,6 +344,16 @@ static inline u32 mdiobus_c45_addr(int d + return MII_ADDR_C45 | devad << MII_DEVADDR_C45_SHIFT | regnum; + } + ++static inline u16 mdiobus_c45_regad(u32 regnum) ++{ ++ return FIELD_GET(MII_REGADDR_C45_MASK, regnum); ++} ++ ++static inline u16 mdiobus_c45_devad(u32 regnum) ++{ ++ return FIELD_GET(MII_DEVADDR_C45_MASK, regnum); ++} ++ + static inline int __mdiobus_c45_read(struct mii_bus *bus, int prtad, int devad, + u16 regnum) + { diff --git a/target/linux/mediatek/patches-5.10/703-v5.17-net-ethernet-mtk_eth_soc-implement-Clause-45-MDIO-ac.patch b/target/linux/mediatek/patches-5.10/703-v5.17-net-ethernet-mtk_eth_soc-implement-Clause-45-MDIO-ac.patch new file mode 100644 index 0000000000..88c600f791 --- /dev/null +++ b/target/linux/mediatek/patches-5.10/703-v5.17-net-ethernet-mtk_eth_soc-implement-Clause-45-MDIO-ac.patch @@ -0,0 +1,128 @@ +From e2e7f6e29c99a1c6afc0e0aa4b9ea80302d28720 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Tue, 4 Jan 2022 12:07:46 +0000 +Subject: [PATCH 3/3] net: ethernet: mtk_eth_soc: implement Clause 45 MDIO + access + +Implement read and write access to IEEE 802.3 Clause 45 Ethernet +phy registers while making use of new mdiobus_c45_regad and +mdiobus_c45_devad helpers. + +Tested on the Ubiquiti UniFi 6 LR access point featuring +MediaTek MT7622BV WiSoC with Aquantia AQR112C. + +Signed-off-by: Daniel Golle +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 70 +++++++++++++++++---- + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 3 + + 2 files changed, 60 insertions(+), 13 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -104,13 +104,35 @@ static int _mtk_mdio_write(struct mtk_et + if (ret < 0) + return ret; + +- mtk_w32(eth, PHY_IAC_ACCESS | +- PHY_IAC_START_C22 | +- PHY_IAC_CMD_WRITE | +- PHY_IAC_REG(phy_reg) | +- PHY_IAC_ADDR(phy_addr) | +- PHY_IAC_DATA(write_data), +- MTK_PHY_IAC); ++ if (phy_reg & MII_ADDR_C45) { ++ mtk_w32(eth, PHY_IAC_ACCESS | ++ PHY_IAC_START_C45 | ++ PHY_IAC_CMD_C45_ADDR | ++ PHY_IAC_REG(mdiobus_c45_devad(phy_reg)) | ++ PHY_IAC_ADDR(phy_addr) | ++ PHY_IAC_DATA(mdiobus_c45_regad(phy_reg)), ++ MTK_PHY_IAC); ++ ++ ret = mtk_mdio_busy_wait(eth); ++ if (ret < 0) ++ return ret; ++ ++ mtk_w32(eth, PHY_IAC_ACCESS | ++ PHY_IAC_START_C45 | ++ PHY_IAC_CMD_WRITE | ++ PHY_IAC_REG(mdiobus_c45_devad(phy_reg)) | ++ PHY_IAC_ADDR(phy_addr) | ++ PHY_IAC_DATA(write_data), ++ MTK_PHY_IAC); ++ } else { ++ mtk_w32(eth, PHY_IAC_ACCESS | ++ PHY_IAC_START_C22 | ++ PHY_IAC_CMD_WRITE | ++ PHY_IAC_REG(phy_reg) | ++ PHY_IAC_ADDR(phy_addr) | ++ PHY_IAC_DATA(write_data), ++ MTK_PHY_IAC); ++ } + + ret = mtk_mdio_busy_wait(eth); + if (ret < 0) +@@ -127,12 +149,33 @@ static int _mtk_mdio_read(struct mtk_eth + if (ret < 0) + return ret; + +- mtk_w32(eth, PHY_IAC_ACCESS | +- PHY_IAC_START_C22 | +- PHY_IAC_CMD_C22_READ | +- PHY_IAC_REG(phy_reg) | +- PHY_IAC_ADDR(phy_addr), +- MTK_PHY_IAC); ++ if (phy_reg & MII_ADDR_C45) { ++ mtk_w32(eth, PHY_IAC_ACCESS | ++ PHY_IAC_START_C45 | ++ PHY_IAC_CMD_C45_ADDR | ++ PHY_IAC_REG(mdiobus_c45_devad(phy_reg)) | ++ PHY_IAC_ADDR(phy_addr) | ++ PHY_IAC_DATA(mdiobus_c45_regad(phy_reg)), ++ MTK_PHY_IAC); ++ ++ ret = mtk_mdio_busy_wait(eth); ++ if (ret < 0) ++ return ret; ++ ++ mtk_w32(eth, PHY_IAC_ACCESS | ++ PHY_IAC_START_C45 | ++ PHY_IAC_CMD_C45_READ | ++ PHY_IAC_REG(mdiobus_c45_devad(phy_reg)) | ++ PHY_IAC_ADDR(phy_addr), ++ MTK_PHY_IAC); ++ } else { ++ mtk_w32(eth, PHY_IAC_ACCESS | ++ PHY_IAC_START_C22 | ++ PHY_IAC_CMD_C22_READ | ++ PHY_IAC_REG(phy_reg) | ++ PHY_IAC_ADDR(phy_addr), ++ MTK_PHY_IAC); ++ } + + ret = mtk_mdio_busy_wait(eth); + if (ret < 0) +@@ -591,6 +634,7 @@ static int mtk_mdio_init(struct mtk_eth + eth->mii_bus->name = "mdio"; + eth->mii_bus->read = mtk_mdio_read; + eth->mii_bus->write = mtk_mdio_write; ++ eth->mii_bus->probe_capabilities = MDIOBUS_C22_C45; + eth->mii_bus->priv = eth; + eth->mii_bus->parent = eth->dev; + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -345,9 +345,12 @@ + #define PHY_IAC_ADDR_MASK GENMASK(24, 20) + #define PHY_IAC_ADDR(x) FIELD_PREP(PHY_IAC_ADDR_MASK, (x)) + #define PHY_IAC_CMD_MASK GENMASK(19, 18) ++#define PHY_IAC_CMD_C45_ADDR FIELD_PREP(PHY_IAC_CMD_MASK, 0) + #define PHY_IAC_CMD_WRITE FIELD_PREP(PHY_IAC_CMD_MASK, 1) + #define PHY_IAC_CMD_C22_READ FIELD_PREP(PHY_IAC_CMD_MASK, 2) ++#define PHY_IAC_CMD_C45_READ FIELD_PREP(PHY_IAC_CMD_MASK, 3) + #define PHY_IAC_START_MASK GENMASK(17, 16) ++#define PHY_IAC_START_C45 FIELD_PREP(PHY_IAC_START_MASK, 0) + #define PHY_IAC_START_C22 FIELD_PREP(PHY_IAC_START_MASK, 1) + #define PHY_IAC_DATA_MASK GENMASK(15, 0) + #define PHY_IAC_DATA(x) FIELD_PREP(PHY_IAC_DATA_MASK, (x)) diff --git a/target/linux/mediatek/patches-5.10/704-net-ethernet-mtk_eth_soc-announce-2500baseT.patch b/target/linux/mediatek/patches-5.10/704-net-ethernet-mtk_eth_soc-announce-2500baseT.patch new file mode 100644 index 0000000000..3afbc01017 --- /dev/null +++ b/target/linux/mediatek/patches-5.10/704-net-ethernet-mtk_eth_soc-announce-2500baseT.patch @@ -0,0 +1,10 @@ +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -575,6 +575,7 @@ static void mtk_validate(struct phylink_ + if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_SGMII)) { + phylink_set(mask, 1000baseT_Full); + phylink_set(mask, 1000baseX_Full); ++ phylink_set(mask, 2500baseT_Full); + phylink_set(mask, 2500baseX_Full); + } + if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_RGMII)) { diff --git a/target/linux/mediatek/patches-5.10/721-dts-mt7622-mediatek-fix-300mhz.patch b/target/linux/mediatek/patches-5.10/721-dts-mt7622-mediatek-fix-300mhz.patch new file mode 100644 index 0000000000..f9a5fdbd0d --- /dev/null +++ b/target/linux/mediatek/patches-5.10/721-dts-mt7622-mediatek-fix-300mhz.patch @@ -0,0 +1,27 @@ +From: Jip de Beer +Date: Sun, 9 Jan 2022 13:14:04 +0100 +Subject: [PATCH] mediatek mt7622: fix 300mhz typo in dts + +The lowest frequency should be 300MHz, since that is the label +assigned to the OPP in the mt7622.dtsi device tree, while there is one +missing zero in the actual value. + +To be clear, the lowest frequency should be 300MHz instead of 30MHz. + +As mentioned @dangowrt on the OpenWrt forum there is no benefit in +leaving 30MHz as the lowest frequency. + +Signed-off-by: Jip de Beer +Signed-off-by: Fritz D. Ansel +--- +--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi +@@ -24,7 +24,7 @@ + compatible = "operating-points-v2"; + opp-shared; + opp-300000000 { +- opp-hz = /bits/ 64 <30000000>; ++ opp-hz = /bits/ 64 <300000000>; + opp-microvolt = <950000>; + }; + diff --git a/target/linux/qoriq/generic/target.mk b/target/linux/qoriq/generic/target.mk index b3bdb405f7..c0af2feb76 100644 --- a/target/linux/qoriq/generic/target.mk +++ b/target/linux/qoriq/generic/target.mk @@ -1,3 +1,5 @@ define Target/Description - Build firmware images for NXP QorIQ boards in the AMP series. + Build firmware images for NXP QorIQ boards in the + T-Series(T1-T5) aka AMP Series platforms. + Features the e5500 and e6500 64-bit Power Architecture cores. endef diff --git a/target/linux/ramips/dts/mt7621_linksys_ea6350-v4.dts b/target/linux/ramips/dts/mt7621_linksys_ea6350-v4.dts new file mode 100644 index 0000000000..272b01af1e --- /dev/null +++ b/target/linux/ramips/dts/mt7621_linksys_ea6350-v4.dts @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621_linksys_ea7xxx.dtsi" + +/ { + compatible = "linksys,ea6350-v4", "mediatek,mt7621-soc"; + model = "Linksys EA6350 v4"; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "lan1"; + }; + + port@1 { + status = "okay"; + label = "lan2"; + }; + + port@2 { + status = "okay"; + label = "lan3"; + }; + + port@3 { + status = "okay"; + label = "lan4"; + }; + + port@4 { + status = "okay"; + label = "wan"; + }; + }; +}; diff --git a/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts b/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts new file mode 100644 index 0000000000..13d39195a9 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts @@ -0,0 +1,162 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "raisecom,msg1500-x-00", "mediatek,mt7621-soc"; + model = "RAISECOM MSG1500 X.00"; + + aliases { + led-boot = &led_usb; + led-failsafe = &led_usb; + led-upgrade = &led_usb; + }; + + leds { + compatible = "gpio-leds"; + + wlan2g { + label = "blue:wlan2g"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0radio"; + }; + + wlan5g { + label = "blue:wlan5g"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1radio"; + }; + + led_usb: usb { + label = "blue:usb"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + trigger-sources = <&ehci_port2>; + linux,default-trigger = "usbport"; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wifi { + label = "wifi"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&nand { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Bootloader"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + label = "Config"; + reg = <0x80000 0x80000>; + read-only; + }; + + factory: partition@100000 { + label = "Factory"; + reg = <0x100000 0x40000>; + read-only; + }; + + partition@140000 { + label = "kernel"; + reg = <0x140000 0x400000>; + }; + + partition@540000 { + label = "ubi"; + reg = <0x540000 0x7a40000>; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0>; + /* 5 GHz (phy1) does not take the address from calibration data, + but setting it manually here works */ + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + }; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "lan4"; + }; + + port@1 { + status = "okay"; + label = "lan3"; + }; + + port@2 { + status = "okay"; + label = "lan2"; + }; + + port@3 { + status = "okay"; + label = "lan1"; + }; + + port@4 { + status = "okay"; + label = "wan"; + }; + }; +}; + +&state_default { + gpio { + groups = "i2c", "jtag", "uart3", "wdt"; + function = "gpio"; + }; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; +}; diff --git a/target/linux/ramips/dts/mt7628an_joowin_jw-wr758ac-v1.dts b/target/linux/ramips/dts/mt7628an_joowin_jw-wr758ac-v1.dts new file mode 100644 index 0000000000..c3b52c82c1 --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_joowin_jw-wr758ac-v1.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7628an_joowin_jw-wr758ac.dtsi" + +/ { + compatible = "joowin,jw-wr758ac-v1", "mediatek,mt7628an-soc"; + model = "Joowin WR758AC V1"; +}; diff --git a/target/linux/ramips/dts/mt7628an_joowin_jw-wr758ac-v2.dts b/target/linux/ramips/dts/mt7628an_joowin_jw-wr758ac-v2.dts new file mode 100644 index 0000000000..1cc0d5d38d --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_joowin_jw-wr758ac-v2.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7628an_joowin_jw-wr758ac.dtsi" + +/ { + compatible = "joowin,jw-wr758ac-v2", "mediatek,mt7628an-soc"; + model = "Joowin WR758AC V2"; +}; diff --git a/target/linux/ramips/dts/mt7628an_joowin_jw-wr758ac.dtsi b/target/linux/ramips/dts/mt7628an_joowin_jw-wr758ac.dtsi new file mode 100644 index 0000000000..97845cf02b --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_joowin_jw-wr758ac.dtsi @@ -0,0 +1,124 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7628an.dtsi" + +#include +#include + +/ { + compatible = "joowin,jw-wr758ac", "mediatek,mt7628an-soc"; + + keys { + compatible = "gpio-keys"; + + wps { + label = "wps"; + gpios = <&gpio 38 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + wifi-high { + label = "blue:wifi-high"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + + wifi-med { + label = "blue:wifi-med"; + gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + }; + + wifi-low { + label = "blue:wifi-low"; + gpios = <&gpio 37 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&state_default { + gpio { + groups = "refclk", "wdt", "wled_an"; + function = "gpio"; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; + }; + }; +}; + +&wmac { + status = "okay"; + + mediatek,mtd-eeprom = <&factory 0x0>; +}; + +ðernet { + nvmem-cells = <&macaddr_factory_e000>; + nvmem-cell-names = "mac-address"; +}; + +&esw { + mediatek,portdisable = <0x2f>; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_e000: macaddr@e000 { + reg = <0xe000 0x6>; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index deda0f0a84..a863ab258e 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -913,6 +913,15 @@ define Device/linksys_ea7xxx append-ubi | check-size | linksys-image type=$$$$(LINKSYS_HWNAME) endef +define Device/linksys_ea6350-v4 + $(Device/linksys_ea7xxx) + DEVICE_MODEL := EA6350 + DEVICE_VARIANT := v4 + LINKSYS_HWNAME := EA6350 + DEVICE_PACKAGES += kmod-mt7603 kmod-mt7663-firmware-ap +endef +TARGET_DEVICES += linksys_ea6350-v4 + define Device/linksys_ea7300-v1 $(Device/linksys_ea7xxx) DEVICE_MODEL := EA7300 @@ -1285,6 +1294,23 @@ define Device/planex_vr500 endef TARGET_DEVICES += planex_vr500 +define Device/raisecom_msg1500-x-00 + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_SIZE := 4096k + IMAGE_SIZE := 129280k + UBINIZE_OPTS := -E 5 + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + DEVICE_VENDOR := RAISECOM + DEVICE_MODEL := MSG1500 + DEVICE_VARIANT := X.00 + DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 \ + kmod-usb-ledtrig-usbport uboot-envtools +endef +TARGET_DEVICES += raisecom_msg1500-x-00 + define Device/samknows_whitebox-v8 $(Device/dsa-migration) IMAGE_SIZE := 16064k diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index 69c6afffe7..423715d035 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -221,6 +221,26 @@ define Device/iptime_a604m endef TARGET_DEVICES += iptime_a604m +define Device/joowin_jw-wr758ac + IMAGE_SIZE := 7872k + DEVICE_VENDOR := Joowin + DEVICE_MODEL := WR758AC +endef + +define Device/joowin_jw-wr758ac-v1 + $(Device/joowin_jw-wr758ac) + DEVICE_PACKAGES := kmod-mt76x2 + DEVICE_VARIANT := V1 +endef +TARGET_DEVICES += joowin_jw-wr758ac-v1 + +define Device/joowin_jw-wr758ac-v2 + $(Device/joowin_jw-wr758ac) + DEVICE_PACKAGES := kmod-mt7615e kmod-mt7663-firmware-ap + DEVICE_VARIANT := V2 +endef +TARGET_DEVICES += joowin_jw-wr758ac-v2 + define Device/jotale_js76x8 DEVICE_VENDOR := Jotale DEVICE_MODEL := JS76x8 diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index 6e6cd747c4..29962f41d7 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -55,6 +55,7 @@ gnubee,gb-pc2) linksys,e5600) ucidef_set_led_netdev "wan" "wan link" "blue:wan" "wan" "link" ;; +linksys,ea6350-v4|\ linksys,ea7300-v1|\ linksys,ea7300-v2|\ linksys,ea7500-v2|\ diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 0b11c05c84..52e0b6b572 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -148,6 +148,7 @@ ramips_setup_macs() label_mac=$(mtd_get_mac_binary factory 0x4) ;; linksys,e5600|\ + linksys,ea6350-v4|\ linksys,ea7300-v1|\ linksys,ea7300-v2|\ linksys,ea7500-v2|\ @@ -165,6 +166,11 @@ ramips_setup_macs() wan_mac=$label_mac lan_mac=$(macaddr_add $label_mac 1) ;; + raisecom,msg1500-x-00) + lan_mac=$(mtd_get_mac_ascii Config protest_lan_mac) + wan_mac=$(mtd_get_mac_ascii Config protest_wan_mac) + label_mac=$lan_mac + ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index 8b7c7ab7f0..3c3b1e62e7 100644 --- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -30,6 +30,7 @@ case "$board" in macaddr_setbit_la "$(mtd_get_mac_binary Factory 0x4)" > /sys${DEVPATH}/macaddress ;; linksys,e5600|\ + linksys,ea6350-v4|\ linksys,ea7300-v1|\ linksys,ea7300-v2|\ linksys,ea7500-v2|\ @@ -39,6 +40,11 @@ case "$board" in [ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress ;; + raisecom,msg1500-x-00) + [ "$PHYNBR" = "0" ] && \ + macaddr_setbit_la "$(mtd_get_mac_ascii Config protest_lan_mac)" \ + > /sys${DEVPATH}/macaddress + ;; tenbay,t-mb5eu-v01) hw_mac_addr="$(mtd_get_mac_binary factory 0x4)" [ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr "1" > /sys${DEVPATH}/macaddress diff --git a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount index 7b4a63d663..8382bdf0c5 100755 --- a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount +++ b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount @@ -9,6 +9,7 @@ boot() { echo -e "bootcount\nbootchanged\n" | /usr/sbin/fw_setenv -s - ;; linksys,e5600|\ + linksys,ea6350-v4|\ linksys,ea7300-v1|\ linksys,ea7300-v2|\ linksys,ea7500-v2|\ diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh index c7ddb55b34..8e1bdc157f 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -62,6 +62,7 @@ platform_do_upgrade() { iptime,t5004|\ jcg,q20|\ linksys,e5600|\ + linksys,ea6350-v4|\ linksys,ea7300-v1|\ linksys,ea7300-v2|\ linksys,ea7500-v2|\ @@ -79,6 +80,7 @@ platform_do_upgrade() { netgear,wac104|\ netgear,wac124|\ netis,wf2881|\ + raisecom,msg1500-x-00|\ sercomm,na502|\ xiaomi,mi-router-3g|\ xiaomi,mi-router-3-pro|\ diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network index 08b2e6cebc..43d2647cf0 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network @@ -129,6 +129,8 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "0:lan" "1:lan" "2:lan" "3:wan" "6@eth0" ;; + joowin,jw-wr758ac-v1|\ + joowin,jw-wr758ac-v2|\ tplink,tl-wr902ac-v3|\ wavlink,wl-wn576a2) ucidef_add_switch "switch0" \ diff --git a/target/linux/uml/Makefile b/target/linux/uml/Makefile index 3707ab4b19..ec662989ec 100644 --- a/target/linux/uml/Makefile +++ b/target/linux/uml/Makefile @@ -13,8 +13,7 @@ BOARD:=uml BOARDNAME:=User Mode Linux FEATURES:=squashfs ext4 audio -KERNEL_PATCHVER:=5.4 -KERNEL_TESTING_PATCHVER:=5.10 +KERNEL_PATCHVER:=5.10 include $(INCLUDE_DIR)/target.mk diff --git a/target/linux/uml/config-5.4 b/target/linux/uml/config-5.4 deleted file mode 100644 index 1d35dda2dc..0000000000 --- a/target/linux/uml/config-5.4 +++ /dev/null @@ -1,142 +0,0 @@ -CONFIG_3_LEVEL_PGTABLES=y -CONFIG_64BIT=y -CONFIG_ARCH_DEFCONFIG="arch/um/configs/x86_64_defconfig" -CONFIG_ARCH_DMA_ADDR_T_64BIT=y -CONFIG_ARCH_HAS_KCOV=y -CONFIG_ARCH_NO_PREEMPT=y -CONFIG_BLK_DEV_COW_COMMON=y -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_UBD=y -CONFIG_BLK_DEV_UBD_SYNC=y -CONFIG_BLK_MQ_VIRTIO=y -CONFIG_CC_HAS_KASAN_GENERIC=y -CONFIG_CON_CHAN="xterm" -CONFIG_CON_ZERO_CHAN="fd:0,fd:1" -CONFIG_CPU_SUP_AMD=y -CONFIG_CPU_SUP_CENTAUR=y -CONFIG_CPU_SUP_HYGON=y -CONFIG_CPU_SUP_INTEL=y -CONFIG_CPU_SUP_ZHAOXIN=y -CONFIG_CRC16=y -CONFIG_CRYPTO_CRC32=y -CONFIG_CRYPTO_CRC32C=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_RNG2=y -CONFIG_CRYPTO_SHA1=y -# CONFIG_CRYPTO_TWOFISH_X86_64 is not set -CONFIG_DEBUG_MEMORY_INIT=y -CONFIG_DECOMPRESS_BZIP2=y -CONFIG_DECOMPRESS_GZIP=y -CONFIG_DNOTIFY=y -# CONFIG_EARLY_PRINTK is not set -CONFIG_EXT4_FS=y -CONFIG_F2FS_FS=y -CONFIG_FAILOVER=y -CONFIG_FS_IOMAP=y -CONFIG_FS_MBCACHE=y -CONFIG_FW_LOADER_PAGED_BUF=y -CONFIG_GENERIC_CLOCKEVENTS=y -# CONFIG_GENERIC_CPU is not set -CONFIG_GENERIC_CPU_DEVICES=y -CONFIG_GENERIC_FIND_FIRST_BIT=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_HAVE_ARCH_AUDITSYSCALL=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_HAVE_ASM_MODVERSIONS=y -CONFIG_HAVE_COPY_THREAD_TLS=y -CONFIG_HAVE_DEBUG_BUGVERBOSE=y -CONFIG_HAVE_DEBUG_KMEMLEAK=y -CONFIG_HAVE_FUTEX_CMPXCHG=y -CONFIG_HAVE_NET_DSA=y -CONFIG_HAVE_UID16=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y -CONFIG_HOSTFS=y -CONFIG_HVC_DRIVER=y -CONFIG_HZ_PERIODIC=y -CONFIG_INITRAMFS_SOURCE="" -CONFIG_INIT_ENV_ARG_LIMIT=128 -CONFIG_IRQ_WORK=y -CONFIG_ISO9660_FS=y -CONFIG_JBD2=y -# CONFIG_JFFS2_FS is not set -CONFIG_KALLSYMS=y -CONFIG_KERNEL_STACK_ORDER=2 -CONFIG_LD_SCRIPT_STATIC=y -CONFIG_LOCK_DEBUGGING_SUPPORT=y -# CONFIG_MATOM is not set -CONFIG_MCONSOLE=y -# CONFIG_MCORE2 is not set -CONFIG_MEMFD_CREATE=y -CONFIG_MIGRATION=y -CONFIG_MK8=y -# CONFIG_MMAPPER is not set -CONFIG_MODULES_USE_ELF_RELA=y -# CONFIG_MPSC is not set -CONFIG_NAMESPACES=y -CONFIG_NEED_PER_CPU_KM=y -CONFIG_NET_FAILOVER=y -# CONFIG_NET_NS is not set -CONFIG_NLS=y -CONFIG_NO_DMA=y -CONFIG_NO_IOMEM=y -CONFIG_NR_CPUS=1 -CONFIG_NULL_CHAN=y -# CONFIG_OF is not set -CONFIG_PGTABLE_LEVELS=3 -CONFIG_PHYS_ADDR_T_64BIT=y -CONFIG_PORT_CHAN=y -CONFIG_POSIX_MQUEUE=y -CONFIG_POSIX_MQUEUE_SYSCTL=y -# CONFIG_PROCESSOR_SELECT is not set -CONFIG_PROC_PAGE_MONITOR=y -CONFIG_PTY_CHAN=y -CONFIG_RD_BZIP2=y -CONFIG_RD_GZIP=y -CONFIG_RELAY=y -CONFIG_SOFT_WATCHDOG=m -CONFIG_SRCU=y -CONFIG_SSL=y -CONFIG_SSL_CHAN="pty" -CONFIG_STACKTRACE=y -CONFIG_STATIC_LINK=y -CONFIG_STDERR_CONSOLE=y -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_TINY_SRCU=y -CONFIG_TTY_CHAN=y -CONFIG_UML=y -CONFIG_UML_NET=y -CONFIG_UML_NET_DAEMON=y -CONFIG_UML_NET_DETERMINISTIC_MAC=y -CONFIG_UML_NET_ETHERTAP=y -CONFIG_UML_NET_MCAST=y -# CONFIG_UML_NET_PCAP is not set -CONFIG_UML_NET_SLIP=y -CONFIG_UML_NET_SLIRP=y -CONFIG_UML_NET_TUNTAP=y -# CONFIG_UML_NET_VDE is not set -CONFIG_UML_NET_VECTOR=y -CONFIG_UML_RANDOM=y -# CONFIG_UML_SOUND is not set -CONFIG_UML_TIME_TRAVEL_SUPPORT=y -CONFIG_UML_WATCHDOG=y -CONFIG_UML_X86=y -# CONFIG_USER_NS is not set -CONFIG_VIRTIO=y -CONFIG_VIRTIO_BLK=y -CONFIG_VIRTIO_CONSOLE=y -CONFIG_VIRTIO_NET=y -CONFIG_VIRTIO_UML=y -CONFIG_VM_EVENT_COUNTERS=y -CONFIG_WATCHDOG_CORE=y -CONFIG_X86_64=y -CONFIG_X86_CMOV=y -CONFIG_X86_CMPXCHG64=y -CONFIG_X86_INTEL_USERCOPY=y -CONFIG_X86_INTERNODE_CACHE_SHIFT=6 -CONFIG_X86_L1_CACHE_SHIFT=6 -CONFIG_X86_MINIMUM_CPU_FAMILY=64 -CONFIG_X86_TSC=y -CONFIG_X86_USE_PPRO_CHECKSUM=y -CONFIG_XTERM_CHAN=y -CONFIG_ZLIB_INFLATE=y diff --git a/target/linux/uml/patches-5.4/101-mconsole-exec.patch b/target/linux/uml/patches-5.4/101-mconsole-exec.patch deleted file mode 100644 index ca4f27b53f..0000000000 --- a/target/linux/uml/patches-5.4/101-mconsole-exec.patch +++ /dev/null @@ -1,205 +0,0 @@ -# -# Minimalist mconsole exec patch -# -# 3.10 version (with bit more synchronous behavior) by fingon at iki dot fi -# Adaptation to kernel 3.3.8 made by David Fernández (david at dit.upm.es) for -# Starting point: mconsole-exec-2.6.30.patch for kernel 2.6.30 -# Author of original patch: Paolo Giarrusso, aka Blaisorblade -# (http://www.user-mode-linux.org/~blaisorblade) -# -# Known misfeatures: -# -# - If output is too long, blocks (and breaks horribly) -# (this misfeature from 3.10 patches, when minimalizing the patch; -# workaround: redirect to a shared filesystem if long output is expected) -# -# - Nothing useful is done with stdin -# ---- a/arch/um/drivers/mconsole.h -+++ b/arch/um/drivers/mconsole.h -@@ -85,6 +85,7 @@ extern void mconsole_cad(struct mc_reque - extern void mconsole_stop(struct mc_request *req); - extern void mconsole_go(struct mc_request *req); - extern void mconsole_log(struct mc_request *req); -+extern void mconsole_exec(struct mc_request *req); - extern void mconsole_proc(struct mc_request *req); - extern void mconsole_stack(struct mc_request *req); - ---- a/arch/um/drivers/mconsole_kern.c -+++ b/arch/um/drivers/mconsole_kern.c -@@ -4,6 +4,7 @@ - * Copyright (C) 2001 - 2008 Jeff Dike (jdike@{addtoit,linux.intel}.com) - */ - -+#include - #include - #include - #include -@@ -26,6 +27,7 @@ - #include - #include - #include -+#include - #include - - #include -@@ -121,6 +123,59 @@ void mconsole_log(struct mc_request *req - mconsole_reply(req, "", 0, 0); - } - -+void mconsole_exec(struct mc_request *req) -+{ -+ struct subprocess_info *sub_info; -+ int res, len; -+ struct file *out; -+ char buf[MCONSOLE_MAX_DATA]; -+ -+ char *envp[] = { -+ "HOME=/", "TERM=linux", -+ "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin", -+ NULL -+ }; -+ char *argv[] = { -+ "/bin/sh", "-c", -+ req->request.data + strlen("exec "), -+ NULL -+ }; -+ -+ sub_info = call_usermodehelper_setup("/bin/sh", argv, envp, GFP_ATOMIC, NULL, NULL, NULL); -+ if (sub_info == NULL) { -+ mconsole_reply(req, "call_usermodehelper_setup failed", 1, 0); -+ return; -+ } -+ res = call_usermodehelper_stdoutpipe(sub_info, &out); -+ if (res < 0) { -+ kfree(sub_info); -+ mconsole_reply(req, "call_usermodehelper_stdoutpipe failed", 1, 0); -+ return; -+ } -+ -+ res = call_usermodehelper_exec(sub_info, UMH_WAIT_PROC); -+ if (res < 0) { -+ kfree(sub_info); -+ mconsole_reply(req, "call_usermodehelper_exec failed", 1, 0); -+ return; -+ } -+ -+ for (;;) { -+ len = out->f_op->read(out, buf, sizeof(buf), &out->f_pos); -+ if (len < 0) { -+ mconsole_reply(req, "reading output failed", 1, 0); -+ break; -+ } -+ if (len == 0) -+ break; -+ mconsole_reply_len(req, buf, len, 0, 1); -+ } -+ fput(out); -+ -+ mconsole_reply_len(req, NULL, 0, 0, 0); -+} -+ -+ - void mconsole_proc(struct mc_request *req) - { - struct vfsmount *mnt = task_active_pid_ns(current)->proc_mnt; -@@ -183,6 +238,7 @@ void mconsole_proc(struct mc_request *re - stop - pause the UML; it will do nothing until it receives a 'go' \n\ - go - continue the UML after a 'stop' \n\ - log - make UML enter into the kernel log\n\ -+ exec - pass to /bin/sh -c synchronously\n\ - proc - returns the contents of the UML's /proc/\n\ - stack - returns the stack of the specified pid\n\ - " ---- a/arch/um/drivers/mconsole_user.c -+++ b/arch/um/drivers/mconsole_user.c -@@ -30,6 +30,7 @@ static struct mconsole_command commands[ - { "stop", mconsole_stop, MCONSOLE_PROC }, - { "go", mconsole_go, MCONSOLE_INTR }, - { "log", mconsole_log, MCONSOLE_INTR }, -+ { "exec", mconsole_exec, MCONSOLE_PROC }, - { "proc", mconsole_proc, MCONSOLE_PROC }, - { "stack", mconsole_stack, MCONSOLE_INTR }, - }; ---- a/arch/um/os-Linux/file.c -+++ b/arch/um/os-Linux/file.c -@@ -557,6 +557,8 @@ int os_create_unix_socket(const char *fi - - addr.sun_family = AF_UNIX; - -+ if (len > sizeof(addr.sun_path)) -+ len = sizeof(addr.sun_path); - snprintf(addr.sun_path, len, "%s", file); - - err = bind(sock, (struct sockaddr *) &addr, sizeof(addr)); ---- a/include/linux/kmod.h -+++ b/include/linux/kmod.h -@@ -32,4 +32,6 @@ static inline int request_module_nowait( - #define try_then_request_module(x, mod...) (x) - #endif - -+int call_usermodehelper_stdoutpipe(struct subprocess_info *sub_info, struct file **filp); -+ - #endif /* __LINUX_KMOD_H__ */ ---- a/include/linux/umh.h -+++ b/include/linux/umh.h -@@ -23,6 +23,7 @@ struct subprocess_info { - char **argv; - char **envp; - struct file *file; -+ struct file *stdout; - int wait; - int retval; - pid_t pid; ---- a/kernel/umh.c -+++ b/kernel/umh.c -@@ -76,6 +76,28 @@ static int call_usermodehelper_exec_asyn - flush_signal_handlers(current, 1); - spin_unlock_irq(¤t->sighand->siglock); - -+ /* Install output when needed */ -+ if (sub_info->stdout) { -+ struct files_struct *f = current->files; -+ struct fdtable *fdt; -+ -+ sys_close(1); -+ sys_close(2); -+ get_file(sub_info->stdout); -+ fd_install(1, sub_info->stdout); -+ fd_install(2, sub_info->stdout); -+ spin_lock(&f->file_lock); -+ fdt = files_fdtable(f); -+ __set_bit(1, fdt->open_fds); -+ __clear_bit(1, fdt->close_on_exec); -+ __set_bit(2, fdt->open_fds); -+ __clear_bit(2, fdt->close_on_exec); -+ spin_unlock(&f->file_lock); -+ -+ /* disallow core files */ -+ current->signal->rlim[RLIMIT_CORE] = (struct rlimit){0, 0}; -+ } -+ - /* - * Initial kernel threads share ther FS with init, in order to - * get the init root directory. But we've now created a new -@@ -362,6 +384,20 @@ static void helper_unlock(void) - wake_up(&running_helpers_waitq); - } - -+int call_usermodehelper_stdoutpipe(struct subprocess_info *sub_info, -+ struct file **filp) -+{ -+ struct file *f[2]; -+ -+ if (create_pipe_files(f, 0) < 0) -+ return PTR_ERR(f); -+ -+ sub_info->stdout = f[1]; -+ *filp = f[0]; -+ return 0; -+} -+EXPORT_SYMBOL(call_usermodehelper_stdoutpipe); -+ - /** - * call_usermodehelper_setup - prepare to call a usermode helper - * @path: path to usermode executable diff --git a/target/linux/uml/patches-5.4/102-pseudo-random-mac.patch b/target/linux/uml/patches-5.4/102-pseudo-random-mac.patch deleted file mode 100644 index 19696365a1..0000000000 --- a/target/linux/uml/patches-5.4/102-pseudo-random-mac.patch +++ /dev/null @@ -1,130 +0,0 @@ -=============================================================================== - -This patch makes MAC addresses of network interfaces predictable. In -particular, it adds a small routine that computes MAC addresses of based on -a SHA1 hash of the virtual machine name and interface ID. - -TECHNICAL INFORMATION: - -Applies to vanilla kernel 3.9.4. - -=============================================================================== ---- a/arch/um/drivers/Kconfig -+++ b/arch/um/drivers/Kconfig -@@ -146,6 +146,20 @@ config UML_NET - enable at least one of the following transport options to actually - make use of UML networking. - -+config UML_NET_DETERMINISTIC_MAC -+ bool "Use deterministic MAC addresses for network interfaces" -+ default y -+ depends on UML_NET -+ select CRYPTO_SHA1 -+ help -+ Virtual network devices inside a User-Mode Linux instance must be -+ assigned a MAC (Ethernet) address. If none is specified on the UML -+ command line, one must be automatically computed. If this option is -+ enabled, a randomly generated address is used. Otherwise, if this -+ option is disabled, the address is generated from a SHA1 hash of -+ the umid of the UML instance and the interface name. The latter choice -+ is useful to make MAC addresses predictable. -+ - config UML_NET_ETHERTAP - bool "Ethertap transport" - depends on UML_NET ---- a/arch/um/drivers/net_kern.c -+++ b/arch/um/drivers/net_kern.c -@@ -25,6 +25,14 @@ - #include - #include - -+#include -+#include -+#include -+#include -+#include -+#include -+#include "os.h" -+ - #define DRIVER_NAME "uml-netdev" - - static DEFINE_SPINLOCK(opened_lock); -@@ -286,9 +294,51 @@ static void uml_net_user_timer_expire(st - #endif - } - -+#ifdef CONFIG_UML_NET_DETERMINISTIC_MAC -+ -+/* Compute a SHA1 hash of the UML instance's id and -+ * * an interface name. */ -+static int compute_hash(const char *umid, const char *ifname, char *hash) -+{ -+ struct ahash_request *desc; -+ struct crypto_ahash *tfm; -+ struct scatterlist sg; -+ char vmif[1024]; -+ int ret; -+ -+ strcpy (vmif, umid); -+ strcat (vmif, ifname); -+ -+ tfm = crypto_alloc_ahash("sha1", 0, CRYPTO_ALG_ASYNC); -+ if (IS_ERR(tfm)) -+ return -ENOMEM; -+ -+ desc = ahash_request_alloc(tfm, GFP_KERNEL); -+ if (!desc) { -+ ret = -ENOMEM; -+ goto out; -+ } -+ -+ crypto_ahash_clear_flags(tfm, ~0); -+ -+ sg_init_table(&sg, 1); -+ sg_set_buf(&sg, vmif, strlen(vmif)); -+ -+ ahash_request_set_crypt(desc, &sg, hash, strlen(vmif)); -+ -+ ret = crypto_ahash_digest(desc); -+out: -+ crypto_free_ahash(tfm); -+ -+ return ret; -+} -+ -+#endif -+ - void uml_net_setup_etheraddr(struct net_device *dev, char *str) - { - unsigned char *addr = dev->dev_addr; -+ u8 hash[SHA1_DIGEST_SIZE]; - char *end; - int i; - -@@ -331,9 +381,26 @@ void uml_net_setup_etheraddr(struct net_ - return; - - random: -+#ifndef CONFIG_UML_NET_DETERMINISTIC_MAC - printk(KERN_INFO - "Choosing a random ethernet address for device %s\n", dev->name); - eth_hw_addr_random(dev); -+#else -+ printk(KERN_INFO -+ "Computing a digest to use as ethernet address for device %s\n", dev->name); -+ if (compute_hash(get_umid(), dev->name, hash) < 0) { -+ printk(KERN_WARNING -+ "Could not compute digest to use as ethernet address for device %s. " -+ "Using random address instead.\n", dev->name); -+ random_ether_addr(addr); -+ } -+ else { -+ for (i=0; i < 6; i++) -+ addr[i] = (hash[i] + hash[i+6]) % 0x100; -+ } -+ addr [0] &= 0xfe; /* clear multicast bit */ -+ addr [0] |= 0x02; /* set local assignment bit (IEEE802) */ -+#endif - } - - static DEFINE_SPINLOCK(devices_lock); diff --git a/target/linux/x86/base-files/lib/preinit/01_sysinfo b/target/linux/x86/base-files/lib/preinit/01_sysinfo index 498b076998..97e8e003f3 100644 --- a/target/linux/x86/base-files/lib/preinit/01_sysinfo +++ b/target/linux/x86/base-files/lib/preinit/01_sysinfo @@ -12,12 +12,24 @@ do_sysinfo_x86() { for file in sys_vendor board_vendor; do vendor="$(cat /sys/devices/virtual/dmi/id/$file 2>/dev/null)" + case "$vendor" in + empty | \ + System\ manufacturer | \ + To\ [bB]e\ [fF]illed\ [bB]y\ O\.E\.M\.) + continue + ;; + esac [ -n "$vendor" ] && break done for file in product_name board_name; do product="$(cat /sys/devices/virtual/dmi/id/$file 2>/dev/null)" case "$vendor:$product" in + ?*:empty | \ + ?*:System\ Product\ Name | \ + ?*:To\ [bB]e\ [fF]illed\ [bB]y\ O\.E\.M\.) + continue + ;; "PC Engines:APU") product="apu1" break diff --git a/toolchain/binutils/patches/2.37/600-Close_the_file_descriptor.patch b/toolchain/binutils/patches/2.37/600-Close_the_file_descriptor.patch new file mode 100644 index 0000000000..fef86a9cb5 --- /dev/null +++ b/toolchain/binutils/patches/2.37/600-Close_the_file_descriptor.patch @@ -0,0 +1,184 @@ +From: H.J. Lu +Date: Mon, 26 Jul 2021 12:59:55 +0000 (-0700) +Subject: bfd: Close the file descriptor if there is no archive fd +X-Git-Url: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=1c611b40e6bfc8029bff7696814330b5bc0ee5c0 + +bfd: Close the file descriptor if there is no archive fd + +Close the file descriptor if there is no archive plugin file descriptor +to avoid running out of file descriptors on thin archives with many +archive members. + +bfd/ + + PR ld/28138 + * plugin.c (bfd_plugin_close_file_descriptor): Close the file + descriptor there is no archive plugin file descriptor. + +ld/ + + PR ld/28138 + * testsuite/ld-plugin/lto.exp: Run tmpdir/pr28138 only for + native build. + + PR ld/28138 + * testsuite/ld-plugin/lto.exp: Run ld/28138 tests. + * testsuite/ld-plugin/pr28138.c: New file. + * testsuite/ld-plugin/pr28138-1.c: Likewise. + * testsuite/ld-plugin/pr28138-2.c: Likewise. + * testsuite/ld-plugin/pr28138-3.c: Likewise. + * testsuite/ld-plugin/pr28138-4.c: Likewise. + * testsuite/ld-plugin/pr28138-5.c: Likewise. + * testsuite/ld-plugin/pr28138-6.c: Likewise. + * testsuite/ld-plugin/pr28138-7.c: Likewise. + +(cherry picked from commit 5a98fb7513b559e20dfebdbaa2a471afda3b4742) +(cherry picked from commit 7dc37e1e1209c80e0bab784df6b6bac335e836f2) +--- + +--- a/bfd/plugin.c ++++ b/bfd/plugin.c +@@ -291,6 +291,14 @@ bfd_plugin_close_file_descriptor (bfd *a + && !bfd_is_thin_archive (abfd->my_archive)) + abfd = abfd->my_archive; + ++ /* Close the file descriptor if there is no archive plugin file ++ descriptor. */ ++ if (abfd->archive_plugin_fd == -1) ++ { ++ close (fd); ++ return; ++ } ++ + abfd->archive_plugin_fd_open_count--; + /* Dup the archive plugin file descriptor for later use, which + will be closed by _bfd_archive_close_and_cleanup. */ +--- a/ld/testsuite/ld-plugin/lto.exp ++++ b/ld/testsuite/ld-plugin/lto.exp +@@ -687,6 +687,40 @@ if { [is_elf_format] && [check_lto_share + } + } + ++run_cc_link_tests [list \ ++ [list \ ++ "Build pr28138.a" \ ++ "-T" "" \ ++ {pr28138-1.c pr28138-2.c pr28138-3.c pr28138-4.c pr28138-5.c \ ++ pr28138-6.c pr28138-7.c} {} "pr28138.a" \ ++ ] \ ++ [list \ ++ "Build pr28138.o" \ ++ "" "" \ ++ {pr28138.c} {} \ ++ ] \ ++] ++ ++set exec_output [run_host_cmd "sh" \ ++ "-c \"ulimit -n 20; \ ++ $CC -Btmpdir/ld -o tmpdir/pr28138 \ ++ tmpdir/pr28138.o tmpdir/pr28138.a\""] ++set exec_output [prune_warnings $exec_output] ++if [string match "" $exec_output] then { ++ if { [isnative] } { ++ set exec_output [run_host_cmd "tmpdir/pr28138" ""] ++ if [string match "PASS" $exec_output] then { ++ pass "PR ld/28138" ++ } else { ++ fail "PR ld/28138" ++ } ++ } else { ++ pass "PR ld/28138" ++ } ++} else { ++ fail "PR ld/28138" ++} ++ + set testname "Build liblto-11.a" + remote_file host delete "tmpdir/liblto-11.a" + set catch_output [run_host_cmd "$ar" "rc $plug_opt tmpdir/liblto-11.a tmpdir/lto-11a.o tmpdir/lto-11b.o tmpdir/lto-11c.o"] +--- /dev/null ++++ b/ld/testsuite/ld-plugin/pr28138-1.c +@@ -0,0 +1,6 @@ ++extern int a0(void); ++int ++a1(void) ++{ ++ return 1 + a0(); ++} +--- /dev/null ++++ b/ld/testsuite/ld-plugin/pr28138-2.c +@@ -0,0 +1,6 @@ ++extern int a1(void); ++int ++a2(void) ++{ ++ return 1 + a1(); ++} +--- /dev/null ++++ b/ld/testsuite/ld-plugin/pr28138-3.c +@@ -0,0 +1,6 @@ ++extern int a2(void); ++int ++a3(void) ++{ ++ return 1 + a2(); ++} +--- /dev/null ++++ b/ld/testsuite/ld-plugin/pr28138-4.c +@@ -0,0 +1,6 @@ ++extern int a3(void); ++int ++a4(void) ++{ ++ return 1 + a3(); ++} +--- /dev/null ++++ b/ld/testsuite/ld-plugin/pr28138-5.c +@@ -0,0 +1,6 @@ ++extern int a4(void); ++int ++a5(void) ++{ ++ return 1 + a4(); ++} +--- /dev/null ++++ b/ld/testsuite/ld-plugin/pr28138-6.c +@@ -0,0 +1,6 @@ ++extern int a5(void); ++int ++a6(void) ++{ ++ return 1 + a5(); ++} +--- /dev/null ++++ b/ld/testsuite/ld-plugin/pr28138-7.c +@@ -0,0 +1,6 @@ ++extern int a6(void); ++int ++a7(void) ++{ ++ return 1 + a6(); ++} +--- /dev/null ++++ b/ld/testsuite/ld-plugin/pr28138.c +@@ -0,0 +1,20 @@ ++#include ++ ++extern int a7(void); ++ ++int ++a0(void) ++{ ++ return 0; ++} ++ ++int ++main() ++{ ++ if (a7() == 7) ++ { ++ printf ("PASS\n"); ++ return 0; ++ } ++ return 1; ++} diff --git a/toolchain/glibc/common.mk b/toolchain/glibc/common.mk index b5f2a513b1..e957ff52e5 100644 --- a/toolchain/glibc/common.mk +++ b/toolchain/glibc/common.mk @@ -7,13 +7,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=glibc -PKG_VERSION:=2.33 -PKG_RELEASE:=2 +PKG_VERSION:=2.34 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=9b01145592fdbffbcbb949d680c152ed2bf2375d -PKG_MIRROR_HASH:=a1bf0858828ee0f68c7847ce9504bb10ce943d0c8fe801d7ba307add2a238c5b +PKG_SOURCE_VERSION:=d5ba02f67dd62a63e29c29eebd6c543722aa6b5b +PKG_MIRROR_HASH:=19e49929c7ea3480a0d1213b6763a23a5ed8129a34fe201a985498927c583ce1 PKG_SOURCE_URL:=https://sourceware.org/git/glibc.git PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz @@ -63,7 +63,8 @@ GLIBC_CONFIGURE:= \ --$(if $(CONFIG_SOFT_FLOAT),without,with)-fp \ $(if $(CONFIG_PKG_CC_STACKPROTECTOR_REGULAR),--enable-stack-protector=yes) \ $(if $(CONFIG_PKG_CC_STACKPROTECTOR_STRONG),--enable-stack-protector=strong) \ - --enable-kernel=4.14.0 + $(if $(CONFIG_PKG_RELRO_FULL),--enable-bind-now) \ + --enable-kernel=5.4.0 export libc_cv_ssp=no export libc_cv_ssp_strong=no diff --git a/toolchain/glibc/patches/050-Revert-Disallow-use-of-DES-encryption-functions-in-n.patch b/toolchain/glibc/patches/050-Revert-Disallow-use-of-DES-encryption-functions-in-n.patch index 10d9f65d18..cb2ae0550b 100644 --- a/toolchain/glibc/patches/050-Revert-Disallow-use-of-DES-encryption-functions-in-n.patch +++ b/toolchain/glibc/patches/050-Revert-Disallow-use-of-DES-encryption-functions-in-n.patch @@ -469,7 +469,7 @@ provides them. * Encode Binary Data:: Encoding and Decoding of Binary Data. * Argz and Envz Vectors:: Null-separated string vectors. @end menu -@@ -2426,73 +2426,73 @@ functionality under a different name, su +@@ -2423,73 +2423,73 @@ functionality under a different name, su systems it may be in @file{strings.h} instead. @end deftypefun @@ -596,7 +596,7 @@ provides them. /* The enhanced internationalization capabilities according to XPG4.2 are present. */ #define _XOPEN_ENH_I18N 1 -@@ -1129,17 +1132,25 @@ ssize_t copy_file_range (int __infd, __o +@@ -1146,17 +1149,25 @@ ssize_t copy_file_range (int __infd, __o extern int fdatasync (int __fildes); #endif /* Use POSIX199309 */ @@ -627,7 +627,7 @@ provides them. range [FROM - N + 1, FROM - 1]. If N is odd the first byte in FROM --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h -@@ -962,6 +962,12 @@ extern int getsubopt (char **__restrict +@@ -968,6 +968,12 @@ extern int getsubopt (char **__restrict #endif diff --git a/toolchain/glibc/patches/200-add-dl-search-paths.patch b/toolchain/glibc/patches/200-add-dl-search-paths.patch index 18d751dd1a..08e901d2e6 100644 --- a/toolchain/glibc/patches/200-add-dl-search-paths.patch +++ b/toolchain/glibc/patches/200-add-dl-search-paths.patch @@ -2,7 +2,7 @@ add /usr/lib to default search path for the dynamic linker --- a/Makeconfig +++ b/Makeconfig -@@ -601,6 +601,9 @@ else +@@ -610,6 +610,9 @@ else default-rpath = $(libdir) endif