blob: 16b2f3804ee65ce231fd37fdc470afb7826c15e1 [file] [log] [blame]
Marian Balakowicz5d3cc552008-01-08 18:11:43 +01001/*
2 * (C) Copyright 2008 Semihalf
3 *
4 * (C) Copyright 2000-2006
5 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
6 *
7 * See file CREDITS for list of people who contributed to this
8 * project.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 * MA 02111-1307 USA
24 */
25
Marian Balakowicz75824382008-01-31 13:20:06 +010026#define DEBUG
27
Marian Balakowicz5d3cc552008-01-08 18:11:43 +010028#include <common.h>
29#include <watchdog.h>
30#include <command.h>
31#include <image.h>
32#include <malloc.h>
33#include <zlib.h>
34#include <bzlib.h>
35#include <environment.h>
36#include <asm/byteorder.h>
37
38#if defined(CONFIG_OF_LIBFDT)
39#include <fdt.h>
40#include <libfdt.h>
41#include <fdt_support.h>
Marian Balakowicz5d3cc552008-01-08 18:11:43 +010042#endif
43
44#ifdef CONFIG_LOGBUFFER
45#include <logbuff.h>
46#endif
47
48#ifdef CFG_INIT_RAM_LOCK
49#include <asm/cache.h>
50#endif
51
Marian Balakowicz5d3cc552008-01-08 18:11:43 +010052DECLARE_GLOBAL_DATA_PTR;
Marian Balakowicz5d3cc552008-01-08 18:11:43 +010053
Marian Balakowicz5d3cc552008-01-08 18:11:43 +010054extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
55
56#if defined(CONFIG_CMD_BDI)
57extern int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
58#endif
59
60void __attribute__((noinline))
Marian Balakowiczf13e7b22008-01-08 18:12:17 +010061do_bootm_linux(cmd_tbl_t *cmdtp, int flag,
Marian Balakowicz5d3cc552008-01-08 18:11:43 +010062 int argc, char *argv[],
Marian Balakowiczf13e7b22008-01-08 18:12:17 +010063 image_header_t *hdr,
Marian Balakowicz5d3cc552008-01-08 18:11:43 +010064 int verify)
65{
Marian Balakowicz5d3cc552008-01-08 18:11:43 +010066 ulong initrd_high;
Marian Balakowicz5d3cc552008-01-08 18:11:43 +010067 int initrd_copy_to_ram = 1;
Marian Balakowiczf13e7b22008-01-08 18:12:17 +010068 ulong initrd_start, initrd_end;
69 ulong rd_data, rd_len;
70 image_header_t *rd_hdr;
71
72 ulong cmd_start, cmd_end;
Marian Balakowicz5d3cc552008-01-08 18:11:43 +010073 char *cmdline;
Marian Balakowiczf13e7b22008-01-08 18:12:17 +010074
75 ulong sp;
Marian Balakowicz5d3cc552008-01-08 18:11:43 +010076 char *s;
77 bd_t *kbd;
78 void (*kernel)(bd_t *, ulong, ulong, ulong, ulong);
Marian Balakowiczf13e7b22008-01-08 18:12:17 +010079
Marian Balakowicz4a2ad5f2008-01-31 13:20:07 +010080#if defined(CONFIG_OF_LIBFDT)
Marian Balakowiczf13e7b22008-01-08 18:12:17 +010081 image_header_t *fdt_hdr;
Marian Balakowicz5d3cc552008-01-08 18:11:43 +010082 char *of_flat_tree = NULL;
83 ulong of_data = 0;
84#endif
85
86 if ((s = getenv ("initrd_high")) != NULL) {
87 /* a value of "no" or a similar string will act like 0,
88 * turning the "load high" feature off. This is intentional.
89 */
90 initrd_high = simple_strtoul(s, NULL, 16);
91 if (initrd_high == ~0)
92 initrd_copy_to_ram = 0;
93 } else { /* not set, no restrictions to load high */
94 initrd_high = ~0;
95 }
96
97#ifdef CONFIG_LOGBUFFER
98 kbd=gd->bd;
99 /* Prevent initrd from overwriting logbuffer */
100 if (initrd_high < (kbd->bi_memsize-LOGBUFF_LEN-LOGBUFF_OVERHEAD))
101 initrd_high = kbd->bi_memsize-LOGBUFF_LEN-LOGBUFF_OVERHEAD;
102 debug ("## Logbuffer at 0x%08lX ", kbd->bi_memsize-LOGBUFF_LEN);
103#endif
104
105 /*
106 * Booting a (Linux) kernel image
107 *
108 * Allocate space for command line and board info - the
109 * address should be as high as possible within the reach of
110 * the kernel (see CFG_BOOTMAPSZ settings), but in unused
111 * memory, which means far enough below the current stack
112 * pointer.
113 */
114
115 asm( "mr %0,1": "=r"(sp) : );
116
117 debug ("## Current stack ends at 0x%08lX ", sp);
118
119 sp -= 2048; /* just to be sure */
120 if (sp > CFG_BOOTMAPSZ)
121 sp = CFG_BOOTMAPSZ;
122 sp &= ~0xF;
123
124 debug ("=> set upper limit to 0x%08lX\n", sp);
125
126 cmdline = (char *)((sp - CFG_BARGSIZE) & ~0xF);
127 kbd = (bd_t *)(((ulong)cmdline - sizeof(bd_t)) & ~0xF);
128
129 if ((s = getenv("bootargs")) == NULL)
130 s = "";
131
132 strcpy (cmdline, s);
133
134 cmd_start = (ulong)&cmdline[0];
135 cmd_end = cmd_start + strlen(cmdline);
136
137 *kbd = *(gd->bd);
138
139#ifdef DEBUG
140 printf ("## cmdline at 0x%08lX ... 0x%08lX\n", cmd_start, cmd_end);
141
142#if defined(CONFIG_CMD_BDI)
143 do_bdinfo (NULL, 0, 0, NULL);
144#endif
145#endif
146
147 if ((s = getenv ("clocks_in_mhz")) != NULL) {
148 /* convert all clock information to MHz */
149 kbd->bi_intfreq /= 1000000L;
150 kbd->bi_busfreq /= 1000000L;
151#if defined(CONFIG_MPC8220)
152 kbd->bi_inpfreq /= 1000000L;
153 kbd->bi_pcifreq /= 1000000L;
154 kbd->bi_pevfreq /= 1000000L;
155 kbd->bi_flbfreq /= 1000000L;
156 kbd->bi_vcofreq /= 1000000L;
157#endif
158#if defined(CONFIG_CPM2)
159 kbd->bi_cpmfreq /= 1000000L;
160 kbd->bi_brgfreq /= 1000000L;
161 kbd->bi_sccfreq /= 1000000L;
162 kbd->bi_vco /= 1000000L;
163#endif
164#if defined(CONFIG_MPC5xxx)
165 kbd->bi_ipbfreq /= 1000000L;
166 kbd->bi_pcifreq /= 1000000L;
167#endif /* CONFIG_MPC5xxx */
168 }
169
170 kernel = (void (*)(bd_t *, ulong, ulong, ulong, ulong))image_get_ep (hdr);
171
172 /*
173 * Check if there is an initrd image
174 */
175
Marian Balakowicz4a2ad5f2008-01-31 13:20:07 +0100176#if defined(CONFIG_OF_LIBFDT)
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100177 /* Look for a '-' which indicates to ignore the ramdisk argument */
178 if (argc >= 3 && strcmp(argv[2], "-") == 0) {
179 debug ("Skipping initrd\n");
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100180 rd_len = rd_data = 0;
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100181 }
182 else
183#endif
184 if (argc >= 3) {
185 debug ("Not skipping initrd\n");
186 show_boot_progress (9);
187
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100188 rd_hdr = (image_header_t *)simple_strtoul (argv[2], NULL, 16);
189 printf ("## Loading RAMDisk Image at %08lx ...\n", (ulong)rd_hdr);
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100190
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100191 if (!image_check_magic (rd_hdr)) {
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100192 puts ("Bad Magic Number\n");
193 show_boot_progress (-10);
194 do_reset (cmdtp, flag, argc, argv);
195 }
196
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100197 if (!image_check_hcrc (rd_hdr)) {
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100198 puts ("Bad Header Checksum\n");
199 show_boot_progress (-11);
200 do_reset (cmdtp, flag, argc, argv);
201 }
202 show_boot_progress (10);
203
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100204 print_image_hdr (rd_hdr);
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100205
206 if (verify) {
207 puts (" Verifying Checksum ... ");
208
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100209 if (!image_check_dcrc_wd (rd_hdr, CHUNKSZ)) {
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100210 puts ("Bad Data CRC\n");
211 show_boot_progress (-12);
212 do_reset (cmdtp, flag, argc, argv);
213 }
214 puts ("OK\n");
215 }
216
217 show_boot_progress (11);
218
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100219 if (!image_check_os (rd_hdr, IH_OS_LINUX) ||
220 !image_check_arch (rd_hdr, IH_ARCH_PPC) ||
221 !image_check_type (rd_hdr, IH_TYPE_RAMDISK)) {
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100222 puts ("No Linux PPC Ramdisk Image\n");
223 show_boot_progress (-13);
224 do_reset (cmdtp, flag, argc, argv);
225 }
226
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100227 rd_data = image_get_data (rd_hdr);
228 rd_len = image_get_data_size (rd_hdr);
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100229
230 /*
231 * Now check if we have a multifile image
232 */
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100233 } else if (image_check_type (hdr, IH_TYPE_MULTI)) {
234 /*
235 * Get second entry data start address and len
236 */
237 image_multi_getimg (hdr, 1, &rd_data, &rd_len);
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100238 show_boot_progress (13);
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100239 } else {
240 /*
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100241 * No initrd image
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100242 */
243 show_boot_progress (14);
244
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100245 rd_len = rd_data = 0;
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100246 }
247
Marian Balakowicz4a2ad5f2008-01-31 13:20:07 +0100248#if defined(CONFIG_OF_LIBFDT)
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100249 if(argc > 3) {
250 of_flat_tree = (char *) simple_strtoul(argv[3], NULL, 16);
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100251 fdt_hdr = (image_header_t *)of_flat_tree;
Marian Balakowicz4a2ad5f2008-01-31 13:20:07 +0100252
Marian Balakowicz958fc482008-01-08 18:11:44 +0100253 if (fdt_check_header (of_flat_tree) == 0) {
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100254#ifndef CFG_NO_FLASH
255 if (addr2info((ulong)of_flat_tree) != NULL)
256 of_data = (ulong)of_flat_tree;
257#endif
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100258 } else if (image_check_magic (fdt_hdr)) {
Marian Balakowicz75824382008-01-31 13:20:06 +0100259 ulong image_start, image_end;
260 ulong load_start, load_end;
261
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100262 printf ("## Flat Device Tree at %08lX\n", fdt_hdr);
263 print_image_hdr (fdt_hdr);
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100264
Marian Balakowicz75824382008-01-31 13:20:06 +0100265 image_start = (ulong)fdt_hdr;
266 image_end = image_get_image_end (fdt_hdr);
267
268 load_start = image_get_load (fdt_hdr);
269 load_end = load_start + image_get_data_size (fdt_hdr);
270
271 if ((load_start < image_end) && (load_end > image_start)) {
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100272 puts ("ERROR: fdt overwritten - "
273 "must RESET the board to recover.\n");
274 do_reset (cmdtp, flag, argc, argv);
275 }
276
277 puts (" Verifying Checksum ... ");
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100278 if (!image_check_hcrc (fdt_hdr)) {
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100279 puts ("ERROR: fdt header checksum invalid - "
280 "must RESET the board to recover.\n");
281 do_reset (cmdtp, flag, argc, argv);
282 }
283
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100284 if (!image_check_dcrc (fdt_hdr)) {
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100285 puts ("ERROR: fdt checksum invalid - "
286 "must RESET the board to recover.\n");
287 do_reset (cmdtp, flag, argc, argv);
288 }
289 puts ("OK\n");
290
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100291 if (!image_check_type (fdt_hdr, IH_TYPE_FLATDT)) {
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100292 puts ("ERROR: uImage is not a fdt - "
293 "must RESET the board to recover.\n");
294 do_reset (cmdtp, flag, argc, argv);
295 }
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100296 if (image_get_comp (fdt_hdr) != IH_COMP_NONE) {
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100297 puts ("ERROR: uImage is compressed - "
298 "must RESET the board to recover.\n");
299 do_reset (cmdtp, flag, argc, argv);
300 }
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100301 if (fdt_check_header (of_flat_tree + image_get_header_size ()) != 0) {
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100302 puts ("ERROR: uImage data is not a fdt - "
303 "must RESET the board to recover.\n");
304 do_reset (cmdtp, flag, argc, argv);
305 }
306
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100307 memmove ((void *)image_get_load (fdt_hdr),
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100308 (void *)(of_flat_tree + image_get_header_size ()),
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100309 image_get_data_size (fdt_hdr));
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100310
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100311 of_flat_tree = (char *)image_get_load (fdt_hdr);
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100312 } else {
313 puts ("Did not find a flat Flat Device Tree.\n"
314 "Must RESET the board to recover.\n");
315 do_reset (cmdtp, flag, argc, argv);
316 }
317 printf (" Booting using the fdt at 0x%x\n",
318 of_flat_tree);
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100319 } else if (image_check_type (hdr, IH_TYPE_MULTI)) {
320 ulong fdt_data, fdt_len;
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100321
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100322 image_multi_getimg (hdr, 2, &fdt_data, &fdt_len);
323 if (fdt_len) {
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100324
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100325 of_flat_tree = (char *)fdt_data;
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100326
327#ifndef CFG_NO_FLASH
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100328 /* move the blob if it is in flash (set of_data to !null) */
329 if (addr2info ((ulong)of_flat_tree) != NULL)
330 of_data = (ulong)of_flat_tree;
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100331#endif
332
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100333 if (fdt_check_header (of_flat_tree) != 0) {
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100334 puts ("ERROR: image is not a fdt - "
335 "must RESET the board to recover.\n");
336 do_reset (cmdtp, flag, argc, argv);
337 }
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100338
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100339 if (be32_to_cpu (fdt_totalsize (of_flat_tree)) != fdt_len) {
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100340 puts ("ERROR: fdt size != image size - "
341 "must RESET the board to recover.\n");
342 do_reset (cmdtp, flag, argc, argv);
343 }
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100344 }
345 }
346#endif
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100347 if (!rd_data) {
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100348 debug ("No initrd\n");
349 }
350
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100351 if (rd_data) {
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100352 if (!initrd_copy_to_ram) { /* zero-copy ramdisk support */
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100353 initrd_start = rd_data;
354 initrd_end = initrd_start + rd_len;
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100355 } else {
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100356 initrd_start = (ulong)kbd - rd_len;
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100357 initrd_start &= ~(4096 - 1); /* align on page */
358
359 if (initrd_high) {
360 ulong nsp;
361
362 /*
363 * the inital ramdisk does not need to be within
364 * CFG_BOOTMAPSZ as it is not accessed until after
365 * the mm system is initialised.
366 *
367 * do the stack bottom calculation again and see if
368 * the initrd will fit just below the monitor stack
369 * bottom without overwriting the area allocated
370 * above for command line args and board info.
371 */
372 asm( "mr %0,1": "=r"(nsp) : );
373 nsp -= 2048; /* just to be sure */
374 nsp &= ~0xF;
375 if (nsp > initrd_high) /* limit as specified */
376 nsp = initrd_high;
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100377 nsp -= rd_len;
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100378 nsp &= ~(4096 - 1); /* align on page */
379 if (nsp >= sp)
380 initrd_start = nsp;
381 }
382
383 show_boot_progress (12);
384
385 debug ("## initrd at 0x%08lX ... 0x%08lX (len=%ld=0x%lX)\n",
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100386 rd_data, rd_data + rd_len - 1, rd_len, rd_len);
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100387
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100388 initrd_end = initrd_start + rd_len;
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100389 printf (" Loading Ramdisk to %08lx, end %08lx ... ",
390 initrd_start, initrd_end);
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100391
Marian Balakowiczaf13cdb2008-01-08 18:11:45 +0100392 memmove_wd((void *)initrd_start,
Marian Balakowiczf13e7b22008-01-08 18:12:17 +0100393 (void *)rd_data, rd_len, CHUNKSZ);
Marian Balakowiczaf13cdb2008-01-08 18:11:45 +0100394
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100395 puts ("OK\n");
396 }
397 } else {
398 initrd_start = 0;
399 initrd_end = 0;
400 }
401
402#if defined(CONFIG_OF_LIBFDT)
403
404#ifdef CFG_BOOTMAPSZ
405 /*
406 * The blob must be within CFG_BOOTMAPSZ,
407 * so we flag it to be copied if it is not.
408 */
409 if (of_flat_tree >= (char *)CFG_BOOTMAPSZ)
410 of_data = (ulong)of_flat_tree;
411#endif
412
413 /* move of_flat_tree if needed */
414 if (of_data) {
415 int err;
416 ulong of_start, of_len;
417
418 of_len = be32_to_cpu(fdt_totalsize(of_data));
419
420 /* position on a 4K boundary before the kbd */
421 of_start = (ulong)kbd - of_len;
422 of_start &= ~(4096 - 1); /* align on page */
423 debug ("## device tree at 0x%08lX ... 0x%08lX (len=%ld=0x%lX)\n",
424 of_data, of_data + of_len - 1, of_len, of_len);
425
426 of_flat_tree = (char *)of_start;
427 printf (" Loading Device Tree to %08lx, end %08lx ... ",
428 of_start, of_start + of_len - 1);
429 err = fdt_open_into((void *)of_data, (void *)of_start, of_len);
430 if (err != 0) {
431 puts ("ERROR: fdt move failed - "
432 "must RESET the board to recover.\n");
433 do_reset (cmdtp, flag, argc, argv);
434 }
435 puts ("OK\n");
436 }
437 /*
438 * Add the chosen node if it doesn't exist, add the env and bd_t
439 * if the user wants it (the logic is in the subroutines).
440 */
441 if (of_flat_tree) {
442 if (fdt_chosen(of_flat_tree, initrd_start, initrd_end, 0) < 0) {
443 puts ("ERROR: /chosen node create failed - "
444 "must RESET the board to recover.\n");
445 do_reset (cmdtp, flag, argc, argv);
446 }
447#ifdef CONFIG_OF_HAS_UBOOT_ENV
448 if (fdt_env(of_flat_tree) < 0) {
449 puts ("ERROR: /u-boot-env node create failed - "
450 "must RESET the board to recover.\n");
451 do_reset (cmdtp, flag, argc, argv);
452 }
453#endif
454#ifdef CONFIG_OF_HAS_BD_T
455 if (fdt_bd_t(of_flat_tree) < 0) {
456 puts ("ERROR: /bd_t node create failed - "
457 "must RESET the board to recover.\n");
458 do_reset (cmdtp, flag, argc, argv);
459 }
460#endif
461#ifdef CONFIG_OF_BOARD_SETUP
462 /* Call the board-specific fixup routine */
463 ft_board_setup(of_flat_tree, gd->bd);
464#endif
465 }
Marian Balakowicz4a2ad5f2008-01-31 13:20:07 +0100466#endif /* CONFIG_OF_LIBFDT */
Marian Balakowiczd45d5a12008-01-08 18:11:43 +0100467
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100468 debug ("## Transferring control to Linux (at address %08lx) ...\n",
469 (ulong)kernel);
470
471 show_boot_progress (15);
472
473#if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500)
474 unlock_ram_in_cache();
475#endif
476
Marian Balakowicz4a2ad5f2008-01-31 13:20:07 +0100477#if defined(CONFIG_OF_LIBFDT)
Marian Balakowicz5d3cc552008-01-08 18:11:43 +0100478 if (of_flat_tree) { /* device tree; boot new style */
479 /*
480 * Linux Kernel Parameters (passing device tree):
481 * r3: pointer to the fdt, followed by the board info data
482 * r4: physical pointer to the kernel itself
483 * r5: NULL
484 * r6: NULL
485 * r7: NULL
486 */
487 (*kernel) ((bd_t *)of_flat_tree, (ulong)kernel, 0, 0, 0);
488 /* does not return */
489 }
490#endif
491 /*
492 * Linux Kernel Parameters (passing board info data):
493 * r3: ptr to board info data
494 * r4: initrd_start or 0 if no initrd
495 * r5: initrd_end - unused if r4 is 0
496 * r6: Start of command line string
497 * r7: End of command line string
498 */
499 (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
500 /* does not return */
501}