MIPS: Loongson: Cleanup machtype support
To choose code for different machines by the value of machtype it needs to be initialized as early as possible. So move initialization of mips_machtype to prom_init(). Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com> Cc: linux-mips@linux-mips.org Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
committed by
Ralf Baechle
parent
b6ee75ed4f
commit
04cfb90a92
@@ -29,6 +29,7 @@ extern unsigned long memsize, highmemsize;
|
|||||||
/* loongson-specific command line, env and memory initialization */
|
/* loongson-specific command line, env and memory initialization */
|
||||||
extern void __init prom_init_memory(void);
|
extern void __init prom_init_memory(void);
|
||||||
extern void __init prom_init_cmdline(void);
|
extern void __init prom_init_cmdline(void);
|
||||||
|
extern void __init prom_init_machtype(void);
|
||||||
extern void __init prom_init_env(void);
|
extern void __init prom_init_env(void);
|
||||||
|
|
||||||
/* irq operation functions */
|
/* irq operation functions */
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
* Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology
|
* Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology
|
||||||
* Author: Fuxin Zhang, zhangfx@lemote.com
|
* Author: Fuxin Zhang, zhangfx@lemote.com
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology
|
* Copyright (C) 2009 Lemote Inc.
|
||||||
* Author: Wu Zhangjin, wuzj@lemote.com
|
* Author: Wu Zhangjin, wuzj@lemote.com
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -49,4 +49,6 @@ void __init prom_init_cmdline(void)
|
|||||||
strcat(arcs_cmdline, " console=ttyS0,115200");
|
strcat(arcs_cmdline, " console=ttyS0,115200");
|
||||||
if ((strstr(arcs_cmdline, "root=")) == NULL)
|
if ((strstr(arcs_cmdline, "root=")) == NULL)
|
||||||
strcat(arcs_cmdline, " root=/dev/hda1");
|
strcat(arcs_cmdline, " root=/dev/hda1");
|
||||||
|
|
||||||
|
prom_init_machtype();
|
||||||
}
|
}
|
||||||
|
@@ -15,6 +15,9 @@
|
|||||||
#include <loongson.h>
|
#include <loongson.h>
|
||||||
#include <machine.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[] = {
|
static const char *system_types[] = {
|
||||||
[MACH_LOONGSON_UNKNOWN] "unknown loongson machine",
|
[MACH_LOONGSON_UNKNOWN] "unknown loongson machine",
|
||||||
[MACH_LEMOTE_FL2E] "lemote-fuloong-2e-box",
|
[MACH_LEMOTE_FL2E] "lemote-fuloong-2e-box",
|
||||||
@@ -27,24 +30,28 @@ static const char *system_types[] = {
|
|||||||
|
|
||||||
const char *get_system_type(void)
|
const char *get_system_type(void)
|
||||||
{
|
{
|
||||||
if (mips_machtype == MACH_UNKNOWN)
|
|
||||||
mips_machtype = LOONGSON_MACHTYPE;
|
|
||||||
|
|
||||||
return system_types[mips_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;
|
int machtype = MACH_LEMOTE_FL2E;
|
||||||
|
|
||||||
if (!str)
|
mips_machtype = LOONGSON_MACHTYPE;
|
||||||
return -EINVAL;
|
|
||||||
|
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++)
|
for (; system_types[machtype]; machtype++)
|
||||||
if (strstr(system_types[machtype], str)) {
|
if (strstr(system_types[machtype], str)) {
|
||||||
mips_machtype = machtype;
|
mips_machtype = machtype;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
__setup("machtype=", machtype_setup);
|
|
||||||
|
Reference in New Issue
Block a user