1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
extern int tb_console_init(void);
extern void __NO_RETURN tb_boot_linux(uintptr_t ep, uintptr_t fw_arg);
void tashaboot_main(uintptr_t fw_arg)
{
struct tb_image img;
int ret;
if (tb_console_init())
return;
dprintf(ALWAYS, "tashaboot " TB_VERSION "\n");
{
extern int tb_mmu_enable(void);
extern int tb_mmu_selftest(void);
extern void tb_mmu_disable(void);
if (tb_mmu_enable() == 0) {
if (tb_mmu_selftest() == 0)
dprintf(ALWAYS, "mmu: identity map on\n");
else
dprintf(ALWAYS, "mmu: self test failed, "
"running unmapped\n");
tb_mmu_disable();
}
}
{
extern unsigned long *tb_spin_gates_ptr;
extern int tb_dtb_patch_spin_table(uintptr_t dtb,
uintptr_t *gates,
int ngates);
int n;
if (tb_spin_gates_ptr) {
extern unsigned char tb_pen_stamps[8];
int c;
n = tb_dtb_patch_spin_table(fw_arg,
tb_spin_gates_ptr, 8);
dprintf(ALWAYS, "dtb: %d release addrs patched\n", n);
for (c = 1; c < 8; c++) {
if (tb_pen_stamps[c])
break;
}
dprintf(ALWAYS, "pen: %s\n",
c < 8 ? "secondaries waiting" :
"no secondaries parked");
}
}
ret = tb_load_semihosting(TB_BOOTFILE, TB_LOAD_ADDR, &img);
if (ret) {
dprintf(ALWAYS, "load failed (%d), halting\n", ret);
platform_halt();
}
{
extern int tb_load_raw(const char *fname,
uintptr_t load_addr);
int r = tb_load_raw(TB_INITRD_FILE, TB_INITRD_ADDR);
if (r == 0)
dprintf(ALWAYS, "initrd at %lx\n",
(unsigned long)TB_INITRD_ADDR);
else
dprintf(ALWAYS, "no initrd (%d)\n", r);
}
dprintf(ALWAYS, "loaded %llu bytes at %lx, entry %lx\n",
(unsigned long long)img.size, img.load, img.ep);
dprintf(ALWAYS, "jumping\n");
tb_boot_linux(img.ep, fw_arg);
}
|