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

Function platform_start

freebsd/mips/beri/beri_machdep.c:169–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167}
168
169void
170platform_start(__register_t a0, __register_t a1, __register_t a2,
171 __register_t a3)
172{
173 struct bootinfo *bootinfop;
174 vm_offset_t kernend;
175 uint64_t platform_counter_freq;
176 int argc = a0;
177 char **argv = (char **)a1;
178 char **envp = (char **)a2;
179 long memsize;
180#ifdef FDT
181 vm_offset_t dtbp;
182 void *kmdp;
183#endif
184 int i;
185
186 /* clear the BSS and SBSS segments */
187 kernend = (vm_offset_t)&end;
188 memset(&edata, 0, kernend - (vm_offset_t)(&edata));
189
190 mips_postboot_fixup();
191
192 mips_pcpu0_init();
193
194 /*
195 * Over time, we've changed out boot-time binary interface for the
196 * kernel. Miniboot simply provides a 'memsize' in a3, whereas the
197 * FreeBSD boot loader provides a 'bootinfo *' in a3. While slightly
198 * grody, we support both here by detecting 'pointer-like' values in
199 * a3 and assuming physical memory can never be that back.
200 *
201 * XXXRW: Pull more values than memsize out of bootinfop -- e.g.,
202 * module information.
203 */
204 if (a3 >= 0x9800000000000000ULL) {
205 bootinfop = (void *)a3;
206 memsize = bootinfop->bi_memsize;
207 preload_metadata = (caddr_t)bootinfop->bi_modulep;
208 } else {
209 bootinfop = NULL;
210 memsize = a3;
211 }
212
213#ifdef FDT
214 /*
215 * Find the dtb passed in by the boot loader (currently fictional).
216 */
217 kmdp = preload_search_by_type("elf kernel");
218 dtbp = MD_FETCH(kmdp, MODINFOMD_DTBP, vm_offset_t);
219
220#if defined(FDT_DTB_STATIC)
221 /*
222 * In case the device tree blob was not retrieved (from metadata) try
223 * to use the statically embedded one.
224 */
225 if (dtbp == (vm_offset_t)NULL)
226 dtbp = (vm_offset_t)&fdt_static_dtb;

Callers

nothing calls this directly

Calls 9

memsetFunction · 0.85
mips_postboot_fixupFunction · 0.85
mips_pcpu0_initFunction · 0.85
preload_search_by_typeFunction · 0.85
cninitFunction · 0.85
mips_initFunction · 0.70
mips_timer_early_initFunction · 0.50
printfFunction · 0.50
mips_timer_init_paramsFunction · 0.50

Tested by

no test coverage detected