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,64 @@ 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 (strncmp(mach->mach_id, mips_machid,
66 + strlen(mips_machid)) == 0
68 + mips_machtype = mach->mach_type;
74 + "MIPS: no machine found for id: '%s', registered machines:\n",
76 + printk(KERN_WARNING "%32s %s\n", "id", "name");
78 + list_for_each(this, &mips_machines) {
79 + mach = list_entry(this, struct mips_machine, list);
80 + printk(KERN_WARNING "%32s %s\n",
81 + mach->mach_id, mach->mach_name);
87 +core_initcall(mips_machtype_init);
88 --- a/include/asm-mips/mips_machine.h
89 +++ b/include/asm-mips/mips_machine.h
91 #include <linux/init.h>
92 #include <linux/list.h>
94 +#include <asm/bootinfo.h>
97 unsigned long mach_type;
98 - void (*mach_setup)(void);
101 + void (*mach_setup)(void);
102 struct list_head list;
105 void mips_machine_register(struct mips_machine *) __init;
106 -void mips_machine_setup(unsigned long machtype) __init;
107 +void mips_machine_setup(void) __init;
108 +int mips_machtype_setup(char *id) __init;
109 void mips_machine_set_name(char *name) __init;
111 extern char *mips_machine_name;
113 -#define MIPS_MACHINE(_type, _name, _setup) \
114 -static char machine_name_##_type[] __initdata = _name; \
115 -static struct mips_machine machine_##_type __initdata = \
116 +#define MIPS_MACHINE(_type, _id, _name, _setup) \
117 +static char machine_name_##_type[] __initconst \
118 + __aligned(1) = _name; \
119 +static char machine_id_##_type[] __initconst \
120 + __aligned(1) = _id; \
121 +static struct mips_machine machine_##_type __initconst = \
123 .mach_type = _type, \
124 + .mach_id = machine_id_##_type, \
125 .mach_name = machine_name_##_type, \
126 .mach_setup = _setup, \