|
@@ -15,6 +15,9 @@
|
|
|
#include <loongson.h>
|
|
|
#include <machine.h>
|
|
|
|
|
|
+/* please ensure the length of the machtype string is less than 50 */
|
|
|
+#define MACHTYPE_LEN 50
|
|
|
+
|
|
|
static const char *system_types[] = {
|
|
|
[MACH_LOONGSON_UNKNOWN] "unknown loongson machine",
|
|
|
[MACH_LEMOTE_FL2E] "lemote-fuloong-2e-box",
|
|
@@ -27,24 +30,28 @@ static const char *system_types[] = {
|
|
|
|
|
|
const char *get_system_type(void)
|
|
|
{
|
|
|
- if (mips_machtype == MACH_UNKNOWN)
|
|
|
- mips_machtype = LOONGSON_MACHTYPE;
|
|
|
-
|
|
|
return system_types[mips_machtype];
|
|
|
}
|
|
|
|
|
|
-static __init int machtype_setup(char *str)
|
|
|
+void __init prom_init_machtype(void)
|
|
|
{
|
|
|
+ char *p, str[MACHTYPE_LEN];
|
|
|
int machtype = MACH_LEMOTE_FL2E;
|
|
|
|
|
|
- if (!str)
|
|
|
- return -EINVAL;
|
|
|
+ mips_machtype = LOONGSON_MACHTYPE;
|
|
|
+
|
|
|
+ p = strstr(arcs_cmdline, "machtype=");
|
|
|
+ if (!p)
|
|
|
+ return;
|
|
|
+ p += strlen("machtype=");
|
|
|
+ strncpy(str, p, MACHTYPE_LEN);
|
|
|
+ p = strstr(str, " ");
|
|
|
+ if (p)
|
|
|
+ *p = '\0';
|
|
|
|
|
|
for (; system_types[machtype]; machtype++)
|
|
|
if (strstr(system_types[machtype], str)) {
|
|
|
mips_machtype = machtype;
|
|
|
break;
|
|
|
}
|
|
|
- return 0;
|
|
|
}
|
|
|
-__setup("machtype=", machtype_setup);
|