1 --- a/arch/mips/kernel/mips_machine.c
2 +++ b/arch/mips/kernel/mips_machine.c
7 +#include <linux/string.h>
9 #include <asm/mips_machine.h>
10 -#include <asm/bootinfo.h>
12 static struct list_head mips_machines __initdata =
13 LIST_HEAD_INIT(mips_machines);
14 +static char *mips_machid __initdata;
16 char *mips_machine_name = "Unknown";
18 @@ -55,20 +56,65 @@ void __init mips_machine_set_name(char *
22 -void __init mips_machine_setup(unsigned long machtype)
23 +void __init mips_machine_setup(void)
25 struct mips_machine *mach;
27 - mach = mips_machine_find(machtype);
28 + mach = mips_machine_find(mips_machtype);
30 - printk(KERN_ALERT "MIPS: no machine registered for "
31 - "machtype %lu\n", machtype);
32 + printk(KERN_WARNING "MIPS: no machine registered for "
33 + "machtype %lu\n", mips_machtype);
37 mips_machine_set_name(mach->mach_name);
38 - printk(KERN_INFO "MIPS: machine is %s\n", mips_machine_name);
39 + printk(KERN_NOTICE "MIPS: machine is %s\n", mips_machine_name);
45 +int __init mips_machtype_setup(char *id)
47 + if (mips_machid == NULL)
53 +__setup("machtype=", mips_machtype_setup);
55 +static int __init mips_machtype_init(void)
57 + struct list_head *this;
58 + struct mips_machine *mach;
60 + if (mips_machid == NULL)
63 + list_for_each(this, &mips_machines) {
64 + mach = list_entry(this, struct mips_machine, list);
65 + if (mach->mach_id == NULL)
68 + if (strcmp(mach->mach_id, mips_machid) == 0) {
69 + mips_machtype = mach->mach_type;
75 + "MIPS: no machine found for id: '%s', registered machines:\n",
77 + printk(KERN_WARNING "%32s %s\n", "id", "name");
79 + list_for_each(this, &mips_machines) {
80 + mach = list_entry(this, struct mips_machine, list);
81 + printk(KERN_WARNING "%32s %s\n",
82 + mach->mach_id ? mach->mach_id : "", mach->mach_name);
88 +core_initcall(mips_machtype_init);
89 --- a/include/asm-mips/mips_machine.h
90 +++ b/include/asm-mips/mips_machine.h
92 #include <linux/init.h>
93 #include <linux/list.h>
95 +#include <asm/bootinfo.h>
98 unsigned long mach_type;
99 - void (*mach_setup)(void);
102 + void (*mach_setup)(void);
103 struct list_head list;
106 void mips_machine_register(struct mips_machine *) __init;
107 -void mips_machine_setup(unsigned long machtype) __init;
108 +void mips_machine_setup(void) __init;
109 +int mips_machtype_setup(char *id) __init;
110 void mips_machine_set_name(char *name) __init;
112 extern char *mips_machine_name;
114 -#define MIPS_MACHINE(_type, _name, _setup) \
115 -static char machine_name_##_type[] __initdata = _name; \
116 -static struct mips_machine machine_##_type __initdata = \
117 +#define MIPS_MACHINE(_type, _id, _name, _setup) \
118 +static char machine_name_##_type[] __initconst \
119 + __aligned(1) = _name; \
120 +static char machine_id_##_type[] __initconst \
121 + __aligned(1) = _id; \
122 +static struct mips_machine machine_##_type __initconst = \
124 .mach_type = _type, \
125 + .mach_id = machine_id_##_type, \
126 .mach_name = machine_name_##_type, \
127 .mach_setup = _setup, \