disable pci ide irq sharing by default - probably causes issues on alix (unconfirmed)
[openwrt.git] / target / linux / olpc / patches / 300-block2mtd_init.patch
1 Index: linux-2.6.23/drivers/mtd/devices/block2mtd.c
2 ===================================================================
3 --- linux-2.6.23.orig/drivers/mtd/devices/block2mtd.c 2007-10-25 21:43:40.854599193 +0200
4 +++ linux-2.6.23/drivers/mtd/devices/block2mtd.c 2007-10-25 22:23:19.066125745 +0200
5 @@ -20,6 +20,7 @@
6 #include <linux/buffer_head.h>
7 #include <linux/mutex.h>
8 #include <linux/mount.h>
9 +#include <linux/list.h>
10
11 #define VERSION "$Revision: 1.30 $"
12
13 @@ -27,6 +28,12 @@
14 #define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args)
15 #define INFO(fmt, args...) printk(KERN_INFO "block2mtd: " fmt "\n" , ## args)
16
17 +struct retry {
18 + struct list_head list;
19 + const char *val;
20 +};
21 +
22 +static LIST_HEAD(retry_list);
23
24 /* Info for the block device */
25 struct block2mtd_dev {
26 @@ -38,10 +45,36 @@
27 char devname[0];
28 };
29
30 +static int block2mtd_setup2(const char *val);
31
32 /* Static info about the MTD, used in cleanup_module */
33 static LIST_HEAD(blkmtd_device_list);
34
35 +static int add_retry(const char *val)
36 +{
37 + struct retry *r = kmalloc(sizeof(struct retry), GFP_KERNEL);
38 +
39 + INIT_LIST_HEAD(&r->list);
40 + r->val = val;
41 + list_add(&r->list, &retry_list);
42 +
43 + return 0;
44 +}
45 +
46 +static int __init process_retries(void)
47 +{
48 + struct list_head *p, *tmp;
49 +
50 + list_for_each_safe(p, tmp, &retry_list) {
51 + struct retry *r = list_entry(p, struct retry, list);
52 + block2mtd_setup2(r->val);
53 + msleep(100);
54 + list_del(p);
55 + kfree(r);
56 + }
57 + return 0;
58 +}
59 +rootfs_initcall(process_retries);
60
61 static struct page *page_read(struct address_space *mapping, int index)
62 {
63 @@ -518,7 +551,10 @@
64 if (token[2] && (strlen(token[2]) + 1 > 80))
65 parse_err("mtd device name too long");
66
67 - add_device(name, erase_size, token[2]);
68 + if (add_device(name, erase_size, token[2]) == NULL) {
69 + add_retry(val);
70 + return 0;
71 + }
72
73 return 0;
74 }
75 @@ -534,8 +570,11 @@
76 and block2mtd_init() has already been called,
77 we can parse the argument now. */
78
79 - if (block2mtd_init_called)
80 + if (block2mtd_init_called) {
81 + /* if the call failed (e.g. because the device does not exist yet)
82 + * then try again just before attempting to mount the rootfs */
83 return block2mtd_setup2(val);
84 + }
85
86 /* During early boot stage, we only save the parameters
87 here. We must parse them later: if the param passed
88 Index: linux-2.6.23/init/do_mounts.c
89 ===================================================================
90 --- linux-2.6.23.orig/init/do_mounts.c 2007-10-25 21:39:41.824977672 +0200
91 +++ linux-2.6.23/init/do_mounts.c 2007-10-25 21:41:22.466712918 +0200
92 @@ -241,16 +241,8 @@
93 return 1;
94 }
95
96 -static unsigned int __initdata root_delay;
97 -static int __init root_delay_setup(char *str)
98 -{
99 - root_delay = simple_strtoul(str, NULL, 0);
100 - return 1;
101 -}
102 -
103 __setup("rootflags=", root_data_setup);
104 __setup("rootfstype=", fs_names_setup);
105 -__setup("rootdelay=", root_delay_setup);
106
107 static void __init get_fs_names(char *page)
108 {
109 @@ -426,18 +418,6 @@
110 {
111 int is_floppy;
112
113 - if (root_delay) {
114 - printk(KERN_INFO "Waiting %dsec before mounting root device...\n",
115 - root_delay);
116 - ssleep(root_delay);
117 - }
118 -
119 - /* wait for the known devices to complete their probing */
120 - while (driver_probe_done() != 0)
121 - msleep(100);
122 -
123 - md_run_setup();
124 -
125 if (saved_root_name[0]) {
126 root_device_name = saved_root_name;
127 if (!strncmp(root_device_name, "mtd", 3)) {
128 Index: linux-2.6.23/init/main.c
129 ===================================================================
130 --- linux-2.6.23.orig/init/main.c 2007-10-25 21:35:50.567799083 +0200
131 +++ linux-2.6.23/init/main.c 2007-10-25 21:56:43.279187031 +0200
132 @@ -65,6 +65,7 @@
133 #ifdef CONFIG_X86_LOCAL_APIC
134 #include <asm/smp.h>
135 #endif
136 +#include "do_mounts.h"
137
138 /*
139 * This is one of the first .c files built. Error out early if we have compiler
140 @@ -662,13 +663,14 @@
141 __setup("initcall_debug", initcall_debug_setup);
142
143 extern initcall_t __initcall_start[], __initcall_end[];
144 +extern initcall_t __root_initcall_start[], __root_initcall_end[];
145
146 -static void __init do_initcalls(void)
147 +static void __init do_initcalls(initcall_t *start, initcall_t *end)
148 {
149 initcall_t *call;
150 int count = preempt_count();
151
152 - for (call = __initcall_start; call < __initcall_end; call++) {
153 + for (call = start; call < end; call++) {
154 ktime_t t0, t1, delta;
155 char *msg = NULL;
156 char msgbuf[40];
157 @@ -737,7 +739,7 @@
158 usermodehelper_init();
159 driver_init();
160 init_irq_proc();
161 - do_initcalls();
162 + do_initcalls(__initcall_start, __initcall_end);
163 }
164
165 static int __initdata nosoftlockup;
166 @@ -810,6 +812,14 @@
167 panic("No init found. Try passing init= option to kernel.");
168 }
169
170 +static unsigned int __initdata root_delay;
171 +static int __init root_delay_setup(char *str)
172 +{
173 + root_delay = simple_strtoul(str, NULL, 0);
174 + return 1;
175 +}
176 +__setup("rootdelay=", root_delay_setup);
177 +
178 static int __init kernel_init(void * unused)
179 {
180 lock_kernel();
181 @@ -851,6 +861,17 @@
182
183 if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
184 ramdisk_execute_command = NULL;
185 + if (root_delay) {
186 + printk(KERN_INFO "Waiting %dsec before mounting root device...\n",
187 + root_delay);
188 + ssleep(root_delay);
189 + }
190 + /* wait for the known devices to complete their probing */
191 + while (driver_probe_done() != 0)
192 + msleep(100);
193 + md_run_setup();
194 + do_initcalls(__root_initcall_start, __root_initcall_end);
195 +
196 prepare_namespace();
197 }
198
199 Index: linux-2.6.23/arch/i386/kernel/vmlinux.lds.S
200 ===================================================================
201 --- linux-2.6.23.orig/arch/i386/kernel/vmlinux.lds.S 2007-10-26 00:07:08.465118962 +0200
202 +++ linux-2.6.23/arch/i386/kernel/vmlinux.lds.S 2007-10-26 00:10:15.259763782 +0200
203 @@ -146,6 +146,11 @@
204 INITCALLS
205 __initcall_end = .;
206 }
207 + .root_initcall.init : AT(ADDR(.root_initcall.init) - LOAD_OFFSET) {
208 + __root_initcall_start = .;
209 + INITCALLS_ROOT
210 + __root_initcall_end = .;
211 + }
212 .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
213 __con_initcall_start = .;
214 *(.con_initcall.init)
215 Index: linux-2.6.23/include/asm-generic/vmlinux.lds.h
216 ===================================================================
217 --- linux-2.6.23.orig/include/asm-generic/vmlinux.lds.h 2007-10-26 00:08:46.558708993 +0200
218 +++ linux-2.6.23/include/asm-generic/vmlinux.lds.h 2007-10-26 00:09:24.296859571 +0200
219 @@ -243,12 +243,14 @@
220 *(.initcall4s.init) \
221 *(.initcall5.init) \
222 *(.initcall5s.init) \
223 - *(.initcallrootfs.init) \
224 *(.initcall6.init) \
225 *(.initcall6s.init) \
226 *(.initcall7.init) \
227 *(.initcall7s.init)
228
229 +#define INITCALLS_ROOT \
230 + *(.initcallrootfs.init)
231 +
232 #define PERCPU(align) \
233 . = ALIGN(align); \
234 __per_cpu_start = .; \
This page took 0.046146 seconds and 5 git commands to generate.