MCPcopy Create free account
hub / github.com/F-Stack/f-stack / platform_start

Function platform_start

freebsd/mips/mediatek/mtk_machdep.c:209–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207}
208
209void
210platform_start(__register_t a0 __unused, __register_t a1 __unused,
211 __register_t a2 __unused, __register_t a3 __unused)
212{
213 vm_offset_t kernend;
214 int argc = a0, i;//, res;
215 uint32_t timer_clk;
216 char **argv = (char **)MIPS_PHYS_TO_KSEG0(a1);
217 char **envp = (char **)MIPS_PHYS_TO_KSEG0(a2);
218 void *dtbp;
219 phandle_t chosen;
220 char buf[2048];
221
222 /* clear the BSS and SBSS segments */
223 kernend = (vm_offset_t)&end;
224 memset(&edata, 0, kernend - (vm_offset_t)(&edata));
225
226 mips_postboot_fixup();
227
228 /* Initialize pcpu stuff */
229 mips_pcpu0_init();
230
231 dtbp = &fdt_static_dtb;
232 if (OF_install(OFW_FDT, 0) == FALSE)
233 while (1);
234 if (OF_init((void *)dtbp) != 0)
235 while (1);
236
237 mtk_soc_try_early_detect();
238 mtk_soc_set_cpu_model();
239
240 if ((timer_clk = mtk_soc_get_timerclk()) == 0)
241 timer_clk = 1000000000; /* no such speed yet */
242
243 mips_timer_early_init(timer_clk);
244
245 /* initialize console so that we have printf */
246 boothowto |= (RB_SERIAL | RB_MULTIPLE); /* Use multiple consoles */
247 boothowto |= (RB_VERBOSE);
248 cninit();
249
250 init_static_kenv(boot1_env, sizeof(boot1_env));
251
252 /*
253 * Get bsdbootargs from FDT if specified.
254 */
255 chosen = OF_finddevice("/chosen");
256 if (OF_getprop(chosen, "bsdbootargs", buf, sizeof(buf)) != -1)
257 boothowto |= boot_parse_cmdline(buf);
258
259 printf("FDT DTB at: 0x%08x\n", (uint32_t)dtbp);
260
261 printf("CPU clock: %4dMHz\n", mtk_soc_get_cpuclk()/(1000*1000));
262 printf("Timer clock: %4dMHz\n", timer_clk/(1000*1000));
263 printf("UART clock: %4dMHz\n\n", mtk_soc_get_uartclk()/(1000*1000));
264
265 printf("U-Boot args (from %d args):\n", argc - 1);
266

Callers

nothing calls this directly

Calls 15

memsetFunction · 0.85
mips_postboot_fixupFunction · 0.85
mips_pcpu0_initFunction · 0.85
mtk_soc_try_early_detectFunction · 0.85
mtk_soc_set_cpu_modelFunction · 0.85
mtk_soc_get_timerclkFunction · 0.85
cninitFunction · 0.85
init_static_kenvFunction · 0.85
boot_parse_cmdlineFunction · 0.85
mtk_soc_get_cpuclkFunction · 0.85
mtk_soc_get_uartclkFunction · 0.85
sprintfFunction · 0.85

Tested by

no test coverage detected