summaryrefslogtreecommitdiffstats
path: root/meta/recipes-bsp/u-boot/u-boot/0004-MIPS-bootm-rework-and-fix-broken-bootm-code.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-bsp/u-boot/u-boot/0004-MIPS-bootm-rework-and-fix-broken-bootm-code.patch')
-rw-r--r--meta/recipes-bsp/u-boot/u-boot/0004-MIPS-bootm-rework-and-fix-broken-bootm-code.patch254
1 files changed, 0 insertions, 254 deletions
diff --git a/meta/recipes-bsp/u-boot/u-boot/0004-MIPS-bootm-rework-and-fix-broken-bootm-code.patch b/meta/recipes-bsp/u-boot/u-boot/0004-MIPS-bootm-rework-and-fix-broken-bootm-code.patch
deleted file mode 100644
index 5692c6056c..0000000000
--- a/meta/recipes-bsp/u-boot/u-boot/0004-MIPS-bootm-rework-and-fix-broken-bootm-code.patch
+++ /dev/null
@@ -1,254 +0,0 @@
1From da9d99765476b10fe0a75140a2d4c1f284ffc333 Mon Sep 17 00:00:00 2001
2From: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
3Date: Sun, 1 Nov 2015 17:36:14 +0100
4Subject: [PATCH 4/6] MIPS: bootm: rework and fix broken bootm code
5Organization: O.S. Systems Software LTDA.
6
7The move to 'generic board' as well as changes in the generic
8bootm code broke the boot of FIT uImage's. Especially uImage's
9with additional initramfs images or FDT's do not work anymore.
10
11Refactor the bootm code to work again with the generic bootm code.
12
13Always relocate ramdisk and FDT in step 'bootm prep' because the
14generic bootm code does this only for legacy uImage's.
15
16Move the step 'bootm cmdline' to 'bootm prep' because the Linux
17kernel parameters rd_start and rd_size have to be initialized after
18the relocation of the ramdisk.
19
20Furthermore support the step 'bootm fake'.
21
22Upstream-Status: Backport [2016.01]
23
24Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
25Reviewed-by: Tom Rini <trini@konsulko.com>
26Reviewed-by: Simon Glass <sjg@chromium.org>
27---
28 arch/mips/lib/bootm.c | 163 ++++++++++++++++++++++++--------------------------
29 1 file changed, 78 insertions(+), 85 deletions(-)
30
31diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
32index 9c647aa..a7eddd3 100644
33--- a/arch/mips/lib/bootm.c
34+++ b/arch/mips/lib/bootm.c
35@@ -21,18 +21,6 @@ DECLARE_GLOBAL_DATA_PTR;
36 #define mips_boot_malta 0
37 #endif
38
39-#if defined(CONFIG_MIPS_BOOT_CMDLINE_LEGACY)
40-#define mips_boot_cmdline_legacy 1
41-#else
42-#define mips_boot_cmdline_legacy 0
43-#endif
44-
45-#if defined(CONFIG_MIPS_BOOT_ENV_LEGACY)
46-#define mips_boot_env_legacy 1
47-#else
48-#define mips_boot_env_legacy 0
49-#endif
50-
51 static int linux_argc;
52 static char **linux_argv;
53 static char *linux_argp;
54@@ -62,50 +50,6 @@ void arch_lmb_reserve(struct lmb *lmb)
55 lmb_reserve(lmb, sp, CONFIG_SYS_SDRAM_BASE + gd->ram_size - sp);
56 }
57
58-static int boot_setup_linux(bootm_headers_t *images)
59-{
60- int ret;
61- ulong rd_len;
62-
63- rd_len = images->rd_end - images->rd_start;
64- ret = boot_ramdisk_high(&images->lmb, images->rd_start,
65- rd_len, &images->initrd_start, &images->initrd_end);
66- if (ret)
67- return ret;
68-
69-#if defined(CONFIG_MIPS_BOOT_FDT) && defined(CONFIG_OF_LIBFDT)
70- if (images->ft_len) {
71- boot_fdt_add_mem_rsv_regions(&images->lmb, images->ft_addr);
72-
73- ret = boot_relocate_fdt(&images->lmb, &images->ft_addr,
74- &images->ft_len);
75- if (ret)
76- return ret;
77- }
78-#endif
79-
80- return 0;
81-}
82-
83-static void boot_setup_fdt(bootm_headers_t *images)
84-{
85-#if defined(CONFIG_MIPS_BOOT_FDT) && defined(CONFIG_OF_LIBFDT)
86- u64 mem_start = 0;
87- u64 mem_size = gd->ram_size;
88-
89- debug("## setup FDT\n");
90-
91- fdt_chosen(images->ft_addr);
92- fdt_fixup_memory_banks(images->ft_addr, &mem_start, &mem_size, 1);
93- fdt_fixup_ethernet(images->ft_addr);
94- fdt_initrd(images->ft_addr, images->initrd_start, images->initrd_end);
95-
96-#if defined(CONFIG_OF_BOARD_SETUP)
97- ft_board_setup(images->ft_addr, gd->bd);
98-#endif
99-#endif
100-}
101-
102 static void linux_cmdline_init(void)
103 {
104 linux_argc = 1;
105@@ -197,18 +141,6 @@ static void linux_cmdline_append(bootm_headers_t *images)
106 }
107 }
108
109-static void boot_cmdline_linux(bootm_headers_t *images)
110-{
111- if (mips_boot_cmdline_legacy && !images->ft_len) {
112- linux_cmdline_legacy(images);
113-
114- if (!mips_boot_env_legacy)
115- linux_cmdline_append(images);
116-
117- linux_cmdline_dump();
118- }
119-}
120-
121 static void linux_env_init(void)
122 {
123 linux_env = (char **)(((ulong) linux_argp + 15) & ~15);
124@@ -288,13 +220,81 @@ static void linux_env_legacy(bootm_headers_t *images)
125 }
126 }
127
128+static int boot_reloc_ramdisk(bootm_headers_t *images)
129+{
130+ ulong rd_len = images->rd_end - images->rd_start;
131+
132+ /*
133+ * In case of legacy uImage's, relocation of ramdisk is already done
134+ * by do_bootm_states() and should not repeated in 'bootm prep'.
135+ */
136+ if (images->state & BOOTM_STATE_RAMDISK) {
137+ debug("## Ramdisk already relocated\n");
138+ return 0;
139+ }
140+
141+ return boot_ramdisk_high(&images->lmb, images->rd_start,
142+ rd_len, &images->initrd_start, &images->initrd_end);
143+}
144+
145+static int boot_reloc_fdt(bootm_headers_t *images)
146+{
147+ /*
148+ * In case of legacy uImage's, relocation of FDT is already done
149+ * by do_bootm_states() and should not repeated in 'bootm prep'.
150+ */
151+ if (images->state & BOOTM_STATE_FDT) {
152+ debug("## FDT already relocated\n");
153+ return 0;
154+ }
155+
156+#if CONFIG_IS_ENABLED(MIPS_BOOT_FDT) && CONFIG_IS_ENABLED(OF_LIBFDT)
157+ boot_fdt_add_mem_rsv_regions(&images->lmb, images->ft_addr);
158+ return boot_relocate_fdt(&images->lmb, &images->ft_addr,
159+ &images->ft_len);
160+#else
161+ return 0;
162+#endif
163+}
164+
165+int arch_fixup_memory_node(void *blob)
166+{
167+#if CONFIG_IS_ENABLED(MIPS_BOOT_FDT) && CONFIG_IS_ENABLED(OF_LIBFDT)
168+ u64 mem_start = 0;
169+ u64 mem_size = gd->ram_size;
170+
171+ return fdt_fixup_memory_banks(blob, &mem_start, &mem_size, 1);
172+#else
173+ return 0;
174+#endif
175+}
176+
177+static int boot_setup_fdt(bootm_headers_t *images)
178+{
179+ return image_setup_libfdt(images, images->ft_addr, images->ft_len,
180+ &images->lmb);
181+}
182+
183 static void boot_prep_linux(bootm_headers_t *images)
184 {
185- if (mips_boot_env_legacy && !images->ft_len)
186- linux_env_legacy(images);
187+ boot_reloc_ramdisk(images);
188
189- if (images->ft_len)
190+ if (CONFIG_IS_ENABLED(MIPS_BOOT_FDT) && images->ft_len) {
191+ boot_reloc_fdt(images);
192 boot_setup_fdt(images);
193+ } else {
194+ if (CONFIG_IS_ENABLED(CONFIG_MIPS_BOOT_ENV_LEGACY))
195+ linux_env_legacy(images);
196+
197+ if (CONFIG_IS_ENABLED(MIPS_BOOT_CMDLINE_LEGACY)) {
198+ linux_cmdline_legacy(images);
199+
200+ if (!CONFIG_IS_ENABLED(CONFIG_MIPS_BOOT_ENV_LEGACY))
201+ linux_cmdline_append(images);
202+
203+ linux_cmdline_dump();
204+ }
205+ }
206 }
207
208 static void boot_jump_linux(bootm_headers_t *images)
209@@ -327,35 +327,28 @@ static void boot_jump_linux(bootm_headers_t *images)
210 int do_bootm_linux(int flag, int argc, char * const argv[],
211 bootm_headers_t *images)
212 {
213- int ret;
214-
215 /* No need for those on MIPS */
216 if (flag & BOOTM_STATE_OS_BD_T)
217 return -1;
218
219- if (flag & BOOTM_STATE_OS_CMDLINE) {
220- boot_cmdline_linux(images);
221+ /*
222+ * Cmdline init has been moved to 'bootm prep' because it has to be
223+ * done after relocation of ramdisk to always pass correct values
224+ * for rd_start and rd_size to Linux kernel.
225+ */
226+ if (flag & BOOTM_STATE_OS_CMDLINE)
227 return 0;
228- }
229
230 if (flag & BOOTM_STATE_OS_PREP) {
231 boot_prep_linux(images);
232 return 0;
233 }
234
235- if (flag & BOOTM_STATE_OS_GO) {
236+ if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
237 boot_jump_linux(images);
238 return 0;
239 }
240
241- ret = boot_setup_linux(images);
242- if (ret)
243- return ret;
244-
245- boot_cmdline_linux(images);
246- boot_prep_linux(images);
247- boot_jump_linux(images);
248-
249 /* does not return */
250 return 1;
251 }
252--
2532.6.2
254