0001
0002
0003
0004
0005
0006
0007
0008 #include <linux/errno.h>
0009 #include <asm/bootinfo.h>
0010
0011 #include <loongson.h>
0012 #include <machine.h>
0013
0014
0015 #define MACHTYPE_LEN 50
0016
0017 static const char *system_types[] = {
0018 [MACH_LOONGSON_UNKNOWN] = "unknown loongson machine",
0019 [MACH_LEMOTE_FL2E] = "lemote-fuloong-2e-box",
0020 [MACH_LEMOTE_FL2F] = "lemote-fuloong-2f-box",
0021 [MACH_LEMOTE_ML2F7] = "lemote-mengloong-2f-7inches",
0022 [MACH_LEMOTE_YL2F89] = "lemote-yeeloong-2f-8.9inches",
0023 [MACH_DEXXON_GDIUM2F10] = "dexxon-gdium-2f",
0024 [MACH_LEMOTE_NAS] = "lemote-nas-2f",
0025 [MACH_LEMOTE_LL2F] = "lemote-lynloong-2f",
0026 [MACH_LOONGSON_END] = NULL,
0027 };
0028
0029 const char *get_system_type(void)
0030 {
0031 return system_types[mips_machtype];
0032 }
0033
0034 void __weak __init mach_prom_init_machtype(void)
0035 {
0036 }
0037
0038 void __init prom_init_machtype(void)
0039 {
0040 char *p, str[MACHTYPE_LEN + 1];
0041 int machtype = MACH_LEMOTE_FL2E;
0042
0043 mips_machtype = LOONGSON_MACHTYPE;
0044
0045 p = strstr(arcs_cmdline, "machtype=");
0046 if (!p) {
0047 mach_prom_init_machtype();
0048 return;
0049 }
0050 p += strlen("machtype=");
0051 strncpy(str, p, MACHTYPE_LEN);
0052 str[MACHTYPE_LEN] = '\0';
0053 p = strstr(str, " ");
0054 if (p)
0055 *p = '\0';
0056
0057 for (; system_types[machtype]; machtype++)
0058 if (strstr(system_types[machtype], str)) {
0059 mips_machtype = machtype;
0060 break;
0061 }
0062 }