- patches.suse/slab-handle-memoryless-nodes-v2a.patch: Refresh.
[linux-flexiantxendom0-3.2.10.git] / arch / mips / loongson / common / machtype.c
index 7b34824..0ed52b3 100644 (file)
@@ -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",
@@ -22,29 +25,35 @@ static const char *system_types[] = {
        [MACH_LEMOTE_ML2F7]             "lemote-mengloong-2f-7inches",
        [MACH_LEMOTE_YL2F89]            "lemote-yeeloong-2f-8.9inches",
        [MACH_DEXXON_GDIUM2F10]         "dexxon-gidum-2f-10inches",
+       [MACH_LEMOTE_NAS]               "lemote-nas-2f",
+       [MACH_LEMOTE_LL2F]              "lemote-lynloong-2f",
        [MACH_LOONGSON_END]             NULL,
 };
 
 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);