diff options
author | Felix Fietkau <nbd@openwrt.org> | 2014-08-07 12:40:53 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2014-08-07 12:40:53 +0000 |
commit | e41a0cafff16f2443e587884782172c6d8478771 (patch) | |
tree | 2ab441d85607622857c5d7602918d24312daa7ab /target/linux/ar71xx/patches-3.14/506-MIPS-ath79-prom-parse-redboot-args.patch | |
parent | f75f9606ad6af9f4c62acd45741a7e3880ad7dbb (diff) | |
download | upstream-e41a0cafff16f2443e587884782172c6d8478771.tar.gz upstream-e41a0cafff16f2443e587884782172c6d8478771.tar.bz2 upstream-e41a0cafff16f2443e587884782172c6d8478771.zip |
ar71xx: add linux 3.14 support
Signed-off-by: Zhao, Gang <gang.zhao.42@gmail.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 42038
Diffstat (limited to 'target/linux/ar71xx/patches-3.14/506-MIPS-ath79-prom-parse-redboot-args.patch')
-rw-r--r-- | target/linux/ar71xx/patches-3.14/506-MIPS-ath79-prom-parse-redboot-args.patch | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/target/linux/ar71xx/patches-3.14/506-MIPS-ath79-prom-parse-redboot-args.patch b/target/linux/ar71xx/patches-3.14/506-MIPS-ath79-prom-parse-redboot-args.patch new file mode 100644 index 0000000000..aab959b900 --- /dev/null +++ b/target/linux/ar71xx/patches-3.14/506-MIPS-ath79-prom-parse-redboot-args.patch @@ -0,0 +1,86 @@ +--- a/arch/mips/ath79/prom.c ++++ b/arch/mips/ath79/prom.c +@@ -19,6 +19,8 @@ + + #include "common.h" + ++static char ath79_cmdline_buf[COMMAND_LINE_SIZE] __initdata; ++ + static inline int is_valid_ram_addr(void *addr) + { + if (((u32) addr > KSEG0) && +@@ -32,6 +34,41 @@ static inline int is_valid_ram_addr(void + return 0; + } + ++static void __init ath79_prom_append_cmdline(const char *name, ++ const char *value) ++{ ++ snprintf(ath79_cmdline_buf, sizeof(ath79_cmdline_buf), ++ " %s=%s", name, value); ++ strlcat(arcs_cmdline, ath79_cmdline_buf, sizeof(arcs_cmdline)); ++} ++ ++static const char * __init ath79_prom_find_env(char **envp, const char *name) ++{ ++ const char *ret = NULL; ++ int len; ++ char **p; ++ ++ if (!is_valid_ram_addr(envp)) ++ return NULL; ++ ++ len = strlen(name); ++ for (p = envp; is_valid_ram_addr(*p); p++) { ++ if (strncmp(name, *p, len) == 0 && (*p)[len] == '=') { ++ ret = *p + len + 1; ++ break; ++ } ++ ++ /* RedBoot env comes in pointer pairs - key, value */ ++ if (strncmp(name, *p, len) == 0 && (*p)[len] == 0) ++ if (is_valid_ram_addr(*(++p))) { ++ ret = *p; ++ break; ++ } ++ } ++ ++ return ret; ++} ++ + static __init void ath79_prom_init_cmdline(int argc, char **argv) + { + int i; +@@ -48,7 +85,32 @@ static __init void ath79_prom_init_cmdli + + void __init prom_init(void) + { ++ const char *env; ++ char **envp; ++ + ath79_prom_init_cmdline(fw_arg0, (char **)fw_arg1); ++ ++ envp = (char **)fw_arg2; ++ if (!strstr(arcs_cmdline, "ethaddr=")) { ++ env = ath79_prom_find_env(envp, "ethaddr"); ++ if (env) ++ ath79_prom_append_cmdline("ethaddr", env); ++ } ++ ++ if (!strstr(arcs_cmdline, "board=")) { ++ env = ath79_prom_find_env(envp, "board"); ++ if (env) { ++ /* Workaround for buggy bootloaders */ ++ if (strcmp(env, "RouterStation") == 0 || ++ strcmp(env, "Ubiquiti AR71xx-based board") == 0) ++ env = "UBNT-RS"; ++ ++ if (strcmp(env, "RouterStation PRO") == 0) ++ env = "UBNT-RSPRO"; ++ ++ ath79_prom_append_cmdline("board", env); ++ } ++ } + } + + void __init prom_free_prom_memory(void) |