diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/include/asm/mach-loongson/loongson.h | 1 | ||||
-rw-r--r-- | arch/mips/loongson/common/cmdline.c | 4 | ||||
-rw-r--r-- | arch/mips/loongson/common/machtype.c | 23 |
3 files changed, 19 insertions, 9 deletions
diff --git a/arch/mips/include/asm/mach-loongson/loongson.h b/arch/mips/include/asm/mach-loongson/loongson.h index e6869aa52bc8..efb234437791 100644 --- a/arch/mips/include/asm/mach-loongson/loongson.h +++ b/arch/mips/include/asm/mach-loongson/loongson.h | |||
@@ -29,6 +29,7 @@ extern unsigned long memsize, highmemsize; | |||
29 | /* loongson-specific command line, env and memory initialization */ | 29 | /* loongson-specific command line, env and memory initialization */ |
30 | extern void __init prom_init_memory(void); | 30 | extern void __init prom_init_memory(void); |
31 | extern void __init prom_init_cmdline(void); | 31 | extern void __init prom_init_cmdline(void); |
32 | extern void __init prom_init_machtype(void); | ||
32 | extern void __init prom_init_env(void); | 33 | extern void __init prom_init_env(void); |
33 | 34 | ||
34 | /* irq operation functions */ | 35 | /* irq operation functions */ |
diff --git a/arch/mips/loongson/common/cmdline.c b/arch/mips/loongson/common/cmdline.c index 75f1b243ee4e..7ad47f227477 100644 --- a/arch/mips/loongson/common/cmdline.c +++ b/arch/mips/loongson/common/cmdline.c | |||
@@ -9,7 +9,7 @@ | |||
9 | * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology | 9 | * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology |
10 | * Author: Fuxin Zhang, zhangfx@lemote.com | 10 | * Author: Fuxin Zhang, zhangfx@lemote.com |
11 | * | 11 | * |
12 | * Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology | 12 | * Copyright (C) 2009 Lemote Inc. |
13 | * Author: Wu Zhangjin, wuzj@lemote.com | 13 | * Author: Wu Zhangjin, wuzj@lemote.com |
14 | * | 14 | * |
15 | * This program is free software; you can redistribute it and/or modify it | 15 | * This program is free software; you can redistribute it and/or modify it |
@@ -49,4 +49,6 @@ void __init prom_init_cmdline(void) | |||
49 | strcat(arcs_cmdline, " console=ttyS0,115200"); | 49 | strcat(arcs_cmdline, " console=ttyS0,115200"); |
50 | if ((strstr(arcs_cmdline, "root=")) == NULL) | 50 | if ((strstr(arcs_cmdline, "root=")) == NULL) |
51 | strcat(arcs_cmdline, " root=/dev/hda1"); | 51 | strcat(arcs_cmdline, " root=/dev/hda1"); |
52 | |||
53 | prom_init_machtype(); | ||
52 | } | 54 | } |
diff --git a/arch/mips/loongson/common/machtype.c b/arch/mips/loongson/common/machtype.c index 7b348248de7d..7545fe69089f 100644 --- a/arch/mips/loongson/common/machtype.c +++ b/arch/mips/loongson/common/machtype.c | |||
@@ -15,6 +15,9 @@ | |||
15 | #include <loongson.h> | 15 | #include <loongson.h> |
16 | #include <machine.h> | 16 | #include <machine.h> |
17 | 17 | ||
18 | /* please ensure the length of the machtype string is less than 50 */ | ||
19 | #define MACHTYPE_LEN 50 | ||
20 | |||
18 | static const char *system_types[] = { | 21 | static const char *system_types[] = { |
19 | [MACH_LOONGSON_UNKNOWN] "unknown loongson machine", | 22 | [MACH_LOONGSON_UNKNOWN] "unknown loongson machine", |
20 | [MACH_LEMOTE_FL2E] "lemote-fuloong-2e-box", | 23 | [MACH_LEMOTE_FL2E] "lemote-fuloong-2e-box", |
@@ -27,24 +30,28 @@ static const char *system_types[] = { | |||
27 | 30 | ||
28 | const char *get_system_type(void) | 31 | const char *get_system_type(void) |
29 | { | 32 | { |
30 | if (mips_machtype == MACH_UNKNOWN) | ||
31 | mips_machtype = LOONGSON_MACHTYPE; | ||
32 | |||
33 | return system_types[mips_machtype]; | 33 | return system_types[mips_machtype]; |
34 | } | 34 | } |
35 | 35 | ||
36 | static __init int machtype_setup(char *str) | 36 | void __init prom_init_machtype(void) |
37 | { | 37 | { |
38 | char *p, str[MACHTYPE_LEN]; | ||
38 | int machtype = MACH_LEMOTE_FL2E; | 39 | int machtype = MACH_LEMOTE_FL2E; |
39 | 40 | ||
40 | if (!str) | 41 | mips_machtype = LOONGSON_MACHTYPE; |
41 | return -EINVAL; | 42 | |
43 | p = strstr(arcs_cmdline, "machtype="); | ||
44 | if (!p) | ||
45 | return; | ||
46 | p += strlen("machtype="); | ||
47 | strncpy(str, p, MACHTYPE_LEN); | ||
48 | p = strstr(str, " "); | ||
49 | if (p) | ||
50 | *p = '\0'; | ||
42 | 51 | ||
43 | for (; system_types[machtype]; machtype++) | 52 | for (; system_types[machtype]; machtype++) |
44 | if (strstr(system_types[machtype], str)) { | 53 | if (strstr(system_types[machtype], str)) { |
45 | mips_machtype = machtype; | 54 | mips_machtype = machtype; |
46 | break; | 55 | break; |
47 | } | 56 | } |
48 | return 0; | ||
49 | } | 57 | } |
50 | __setup("machtype=", machtype_setup); | ||