Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 177874
b: refs/heads/master
c: 04cfb90
h: refs/heads/master
v: v3
  • Loading branch information
Wu Zhangjin authored and Ralf Baechle committed Dec 17, 2009
1 parent f422d3c commit 41cc304
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b6ee75ed4fa201873d3a2b32dfce2dbd701a2de4
refs/heads/master: 04cfb90a92a2f9f7b56b2f85c528be7d1561e0e5
1 change: 1 addition & 0 deletions trunk/arch/mips/include/asm/mach-loongson/loongson.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ extern unsigned long memsize, highmemsize;
/* loongson-specific command line, env and memory initialization */
extern void __init prom_init_memory(void);
extern void __init prom_init_cmdline(void);
extern void __init prom_init_machtype(void);
extern void __init prom_init_env(void);

/* irq operation functions */
Expand Down
4 changes: 3 additions & 1 deletion trunk/arch/mips/loongson/common/cmdline.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology
* 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
*
* This program is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -49,4 +49,6 @@ void __init prom_init_cmdline(void)
strcat(arcs_cmdline, " console=ttyS0,115200");
if ((strstr(arcs_cmdline, "root=")) == NULL)
strcat(arcs_cmdline, " root=/dev/hda1");

prom_init_machtype();
}
23 changes: 15 additions & 8 deletions trunk/arch/mips/loongson/common/machtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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);

0 comments on commit 41cc304

Please sign in to comment.