diff options
Diffstat (limited to 'arch/mips/txx9/generic/setup.c')
-rw-r--r-- | arch/mips/txx9/generic/setup.c | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c index 5526375010f8..a13a08b8c9ec 100644 --- a/arch/mips/txx9/generic/setup.c +++ b/arch/mips/txx9/generic/setup.c | |||
@@ -156,11 +156,23 @@ static struct txx9_board_vec *__init find_board_byname(const char *name) | |||
156 | 156 | ||
157 | static void __init prom_init_cmdline(void) | 157 | static void __init prom_init_cmdline(void) |
158 | { | 158 | { |
159 | int argc = (int)fw_arg0; | 159 | int argc; |
160 | int *argv32 = (int *)fw_arg1; | 160 | int *argv32; |
161 | int i; /* Always ignore the "-c" at argv[0] */ | 161 | int i; /* Always ignore the "-c" at argv[0] */ |
162 | char builtin[CL_SIZE]; | 162 | char builtin[CL_SIZE]; |
163 | 163 | ||
164 | if (fw_arg0 >= CKSEG0 || fw_arg1 < CKSEG0) { | ||
165 | /* | ||
166 | * argc is not a valid number, or argv32 is not a valid | ||
167 | * pointer | ||
168 | */ | ||
169 | argc = 0; | ||
170 | argv32 = NULL; | ||
171 | } else { | ||
172 | argc = (int)fw_arg0; | ||
173 | argv32 = (int *)fw_arg1; | ||
174 | } | ||
175 | |||
164 | /* ignore all built-in args if any f/w args given */ | 176 | /* ignore all built-in args if any f/w args given */ |
165 | /* | 177 | /* |
166 | * But if built-in strings was started with '+', append them | 178 | * But if built-in strings was started with '+', append them |
@@ -414,10 +426,12 @@ char * __init prom_getcmdline(void) | |||
414 | 426 | ||
415 | const char *__init prom_getenv(const char *name) | 427 | const char *__init prom_getenv(const char *name) |
416 | { | 428 | { |
417 | const s32 *str = (const s32 *)fw_arg2; | 429 | const s32 *str; |
418 | 430 | ||
419 | if (!str) | 431 | if (fw_arg2 < CKSEG0) |
420 | return NULL; | 432 | return NULL; |
433 | |||
434 | str = (const s32 *)fw_arg2; | ||
421 | /* YAMON style ("name", "value" pairs) */ | 435 | /* YAMON style ("name", "value" pairs) */ |
422 | while (str[0] && str[1]) { | 436 | while (str[0] && str[1]) { |
423 | if (!strcmp((const char *)(unsigned long)str[0], name)) | 437 | if (!strcmp((const char *)(unsigned long)str[0], name)) |
@@ -622,6 +636,21 @@ unsigned long (*__swizzle_addr_b)(unsigned long port) = __swizzle_addr_none; | |||
622 | EXPORT_SYMBOL(__swizzle_addr_b); | 636 | EXPORT_SYMBOL(__swizzle_addr_b); |
623 | #endif | 637 | #endif |
624 | 638 | ||
639 | #ifdef NEEDS_TXX9_IOSWABW | ||
640 | static u16 ioswabw_default(volatile u16 *a, u16 x) | ||
641 | { | ||
642 | return le16_to_cpu(x); | ||
643 | } | ||
644 | static u16 __mem_ioswabw_default(volatile u16 *a, u16 x) | ||
645 | { | ||
646 | return x; | ||
647 | } | ||
648 | u16 (*ioswabw)(volatile u16 *a, u16 x) = ioswabw_default; | ||
649 | EXPORT_SYMBOL(ioswabw); | ||
650 | u16 (*__mem_ioswabw)(volatile u16 *a, u16 x) = __mem_ioswabw_default; | ||
651 | EXPORT_SYMBOL(__mem_ioswabw); | ||
652 | #endif | ||
653 | |||
625 | void __init txx9_physmap_flash_init(int no, unsigned long addr, | 654 | void __init txx9_physmap_flash_init(int no, unsigned long addr, |
626 | unsigned long size, | 655 | unsigned long size, |
627 | const struct physmap_flash_data *pdata) | 656 | const struct physmap_flash_data *pdata) |