diff options
author | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2013-05-13 19:13:33 +0000 |
---|---|---|
committer | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2013-05-13 19:13:33 +0000 |
commit | cbf4bc92c6a44cdc27ec4052ff1eced445cc4d2b (patch) | |
tree | 435394cb095364d72c68a99d169733756d5ecef9 /target/linux/ar71xx/files/arch/mips/ath79/routerboot.c | |
parent | 048d9254497c80e71131b456c1077893adb40c18 (diff) |
ar71xx: add hard_cfg offset detection for rb2011 support - fixes wlan on some newer devices
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@36631 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ar71xx/files/arch/mips/ath79/routerboot.c')
-rw-r--r-- | target/linux/ar71xx/files/arch/mips/ath79/routerboot.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/routerboot.c b/target/linux/ar71xx/files/arch/mips/ath79/routerboot.c index 3c6f9aaeb..1cb1f9d4e 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/routerboot.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/routerboot.c @@ -30,6 +30,26 @@ static u16 get_u16(void *buf) } __init int +routerboot_find_magic(u8 *buf, unsigned int buflen, u32 *offset, bool hard) +{ + u32 magic_ref = hard ? RB_MAGIC_HARD : RB_MAGIC_SOFT; + u32 magic; + u32 cur = *offset; + + while (cur < buflen) { + magic = get_u32(buf + cur); + if (magic == magic_ref) { + *offset = cur; + return 0; + } + + cur += 0x1000; + } + + return -ENOENT; +} + +__init int routerboot_find_tag(u8 *buf, unsigned int buflen, u16 tag_id, u8 **tag_data, u16 *tag_len) { |