[ramips] update to 2.6.34, signed of by russiane39, thx
[openwrt/svn-archive/archive.git] / target / linux / ramips / patches-2.6.34 / 400-mips-multi-machine-update.patch
1 --- a/arch/mips/kernel/mips_machine.c
2 +++ b/arch/mips/kernel/mips_machine.c
3 @@ -7,12 +7,14 @@
4 *
5 */
6 #include <linux/mm.h>
7 +#include <linux/string.h>
8 +#include <linux/slab.h>
9
10 #include <asm/mips_machine.h>
11 -#include <asm/bootinfo.h>
12
13 static struct list_head mips_machines __initdata =
14 LIST_HEAD_INIT(mips_machines);
15 +static char *mips_machid __initdata;
16
17 char *mips_machine_name = "Unknown";
18
19 @@ -55,20 +56,65 @@ void __init mips_machine_set_name(char *
20 }
21 }
22
23 -void __init mips_machine_setup(unsigned long machtype)
24 +void __init mips_machine_setup(void)
25 {
26 struct mips_machine *mach;
27
28 - mach = mips_machine_find(machtype);
29 + mach = mips_machine_find(mips_machtype);
30 if (!mach) {
31 - printk(KERN_ALERT "MIPS: no machine registered for "
32 - "machtype %lu\n", machtype);
33 + printk(KERN_WARNING "MIPS: no machine registered for "
34 + "machtype %lu\n", mips_machtype);
35 return;
36 }
37
38 mips_machine_set_name(mach->mach_name);
39 - printk(KERN_INFO "MIPS: machine is %s\n", mips_machine_name);
40 + printk(KERN_NOTICE "MIPS: machine is %s\n", mips_machine_name);
41
42 if (mach->mach_setup)
43 mach->mach_setup();
44 }
45 +
46 +int __init mips_machtype_setup(char *id)
47 +{
48 + if (mips_machid == NULL)
49 + mips_machid = id;
50 +
51 + return 1;
52 +}
53 +
54 +__setup("machtype=", mips_machtype_setup);
55 +
56 +static int __init mips_machtype_init(void)
57 +{
58 + struct list_head *this;
59 + struct mips_machine *mach;
60 +
61 + if (mips_machid == NULL)
62 + return 0;
63 +
64 + list_for_each(this, &mips_machines) {
65 + mach = list_entry(this, struct mips_machine, list);
66 + if (mach->mach_id == NULL)
67 + continue;
68 +
69 + if (strcmp(mach->mach_id, mips_machid) == 0) {
70 + mips_machtype = mach->mach_type;
71 + return 0;
72 + }
73 + }
74 +
75 + printk(KERN_WARNING
76 + "MIPS: no machine found for id: '%s', registered machines:\n",
77 + mips_machid);
78 + printk(KERN_WARNING "%32s %s\n", "id", "name");
79 +
80 + list_for_each(this, &mips_machines) {
81 + mach = list_entry(this, struct mips_machine, list);
82 + printk(KERN_WARNING "%32s %s\n",
83 + mach->mach_id ? mach->mach_id : "", mach->mach_name);
84 + }
85 +
86 + return 0;
87 +}
88 +
89 +core_initcall(mips_machtype_init);
90 --- a/arch/mips/include/asm/mips_machine.h
91 +++ b/arch/mips/include/asm/mips_machine.h
92 @@ -13,25 +13,33 @@
93 #include <linux/init.h>
94 #include <linux/list.h>
95
96 +#include <asm/bootinfo.h>
97 +
98 struct mips_machine {
99 unsigned long mach_type;
100 - void (*mach_setup)(void);
101 + char *mach_id;
102 char *mach_name;
103 + void (*mach_setup)(void);
104 struct list_head list;
105 };
106
107 void mips_machine_register(struct mips_machine *) __init;
108 -void mips_machine_setup(unsigned long machtype) __init;
109 +void mips_machine_setup(void) __init;
110 +int mips_machtype_setup(char *id) __init;
111 void mips_machine_set_name(char *name) __init;
112
113 extern char *mips_machine_name;
114
115 -#define MIPS_MACHINE(_type, _name, _setup) \
116 -static char machine_name_##_type[] __initdata = _name; \
117 +#define MIPS_MACHINE(_type, _id, _name, _setup) \
118 +static const char machine_name_##_type[] __initconst \
119 + __aligned(1) = _name; \
120 +static const char machine_id_##_type[] __initconst \
121 + __aligned(1) = _id; \
122 static struct mips_machine machine_##_type __initdata = \
123 { \
124 .mach_type = _type, \
125 - .mach_name = machine_name_##_type, \
126 + .mach_id = (char *) machine_id_##_type, \
127 + .mach_name = (char *) machine_name_##_type, \
128 .mach_setup = _setup, \
129 }; \
130 \
131 @@ -44,4 +52,3 @@ static int __init register_machine_##_ty
132 pure_initcall(register_machine_##_type)
133
134 #endif /* __ASM_MIPS_MACHINE_H */
135 -