1
2
3
4
5
6
7#include <common.h>
8#include <cpu_func.h>
9#include <env.h>
10#include <image.h>
11#include <irq_func.h>
12#include <log.h>
13#include <asm/global_data.h>
14
15DECLARE_GLOBAL_DATA_PTR;
16
17#define NIOS_MAGIC 0x534f494e
18
19int do_bootm_linux(int flag, int argc, char *const argv[],
20 bootm_headers_t *images)
21{
22 void (*kernel)(int, int, int, char *) = (void *)images->ep;
23 char *commandline = env_get("bootargs");
24 ulong initrd_start = images->rd_start;
25 ulong initrd_end = images->rd_end;
26 char *of_flat_tree = NULL;
27#if defined(CONFIG_OF_LIBFDT)
28
29 if (images->ft_len)
30 of_flat_tree = images->ft_addr;
31#endif
32 if (!of_flat_tree && argc > 1)
33 of_flat_tree = (char *)hextoul(argv[1], NULL);
34 if (of_flat_tree)
35 initrd_end = (ulong)of_flat_tree;
36
37
38
39
40 if (flag & BOOTM_STATE_OS_PREP)
41 return 0;
42
43 if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
44 return 1;
45
46
47 disable_interrupts();
48 flush_dcache_all();
49
50 debug("bootargs=%s @ 0x%lx\n", commandline, (ulong)&commandline);
51 debug("initrd=0x%lx-0x%lx\n", (ulong)initrd_start, (ulong)initrd_end);
52
53
54
55
56
57
58
59
60
61 kernel(NIOS_MAGIC, initrd_start, initrd_end, commandline);
62
63
64 return 1;
65}
66
67static ulong get_sp(void)
68{
69 ulong ret;
70
71 asm("mov %0, sp" : "=r"(ret) : );
72 return ret;
73}
74
75void arch_lmb_reserve(struct lmb *lmb)
76{
77 arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096);
78}
79