static int bootstrap2(void *arg) { dprintf(SPEW, "top of bootstrap2()\n"); lk_init_level(LK_INIT_LEVEL_ARCH - 1); arch_init(); // initialize the rest of the platform dprintf(SPEW, "initializing platform\n"); lk_init_level(LK_INIT_LEVEL_PLATFORM - 1); platform_init(); // initialize the target dprintf(SPEW, "initializing target\n"); lk_init_level(LK_INIT_LEVEL_TARGET - 1); target_init(); dprintf(SPEW, "calling apps_init()\n"); lk_init_level(LK_INIT_LEVEL_APPS - 1); apps_init(); lk_init_level(LK_INIT_LEVEL_LAST); return 0; }
static int secondary_cpu_bootstrap2(void *arg) { /* secondary cpu initialize from threading level up. 0 to threading was handled in arch */ lk_init_level(LK_INIT_FLAG_SECONDARY_CPUS, LK_INIT_LEVEL_THREADING, LK_INIT_LEVEL_LAST); return 0; }
void lk_main(void) { inc_critical_section(); // get us into some sort of thread context thread_init_early(); // early arch stuff lk_init_level(LK_INIT_LEVEL_ARCH_EARLY - 1); arch_early_init(); // do any super early platform initialization lk_init_level(LK_INIT_LEVEL_PLATFORM_EARLY - 1); platform_early_init(); // do any super early target initialization lk_init_level(LK_INIT_LEVEL_TARGET_EARLY - 1); target_early_init(); dprintf(INFO, "welcome to lk\n\n"); #if WITH_PLATFORM_MSM_SHARED bs_set_timestamp(BS_BL_START); #endif // deal with any static constructors dprintf(SPEW, "calling constructors\n"); call_constructors(); // bring up the kernel heap dprintf(SPEW, "initializing heap\n"); lk_init_level(LK_INIT_LEVEL_HEAP - 1); heap_init(); #if WITH_PLATFORM_MSM_SHARED __stack_chk_guard_setup(); #endif // initialize the kernel lk_init_level(LK_INIT_LEVEL_KERNEL - 1); kernel_init(); lk_init_level(LK_INIT_LEVEL_THREADING - 1); #if (!ENABLE_NANDWRITE) // create a thread to complete system initialization dprintf(SPEW, "creating bootstrap completion thread\n"); thread_t *t = thread_create("bootstrap2", &bootstrap2, NULL, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE); thread_detach(t); thread_resume(t); // become the idle thread and enable interrupts to start the scheduler thread_become_idle(); #else bootstrap_nandwrite(); #endif }
void lk_main(ulong arg0, ulong arg1, ulong arg2, ulong arg3) { inc_critical_section(); // save the boot args lk_boot_args[0] = arg0; lk_boot_args[1] = arg1; lk_boot_args[2] = arg2; lk_boot_args[3] = arg3; // get us into some sort of thread context thread_init_early(); // early arch stuff lk_init_level(LK_INIT_LEVEL_ARCH_EARLY - 1); arch_early_init(); // do any super early platform initialization lk_init_level(LK_INIT_LEVEL_PLATFORM_EARLY - 1); platform_early_init(); // do any super early target initialization lk_init_level(LK_INIT_LEVEL_TARGET_EARLY - 1); target_early_init(); dprintf(INFO, "welcome to lk\n\n"); dprintf(INFO, "boot args 0x%lx 0x%lx 0x%lx 0x%lx\n", lk_boot_args[0], lk_boot_args[1], lk_boot_args[2], lk_boot_args[3]); // deal with any static constructors dprintf(SPEW, "calling constructors\n"); call_constructors(); // bring up the kernel heap dprintf(SPEW, "initializing heap\n"); lk_init_level(LK_INIT_LEVEL_HEAP - 1); heap_init(); // initialize the kernel lk_init_level(LK_INIT_LEVEL_KERNEL - 1); kernel_init(); lk_init_level(LK_INIT_LEVEL_THREADING - 1); // create a thread to complete system initialization dprintf(SPEW, "creating bootstrap completion thread\n"); thread_t *t = thread_create("bootstrap2", &bootstrap2, NULL, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE); thread_detach(t); thread_resume(t); // become the idle thread and enable interrupts to start the scheduler thread_become_idle(); }
void arm64_secondary_entry(ulong asm_cpu_num) { uint cpu = arch_curr_cpu_num(); if (cpu != asm_cpu_num) return; arm64_cpu_early_init(); spin_lock(&arm_boot_cpu_lock); spin_unlock(&arm_boot_cpu_lock); /* run early secondary cpu init routines up to the threading level */ lk_init_level(LK_INIT_FLAG_SECONDARY_CPUS, LK_INIT_LEVEL_EARLIEST, LK_INIT_LEVEL_THREADING - 1); arch_mp_init_percpu(); LTRACEF("cpu num %d\n", cpu); /* we're done, tell the main cpu we're up */ atomic_add(&secondaries_to_init, -1); __asm__ volatile("sev"); lk_secondary_cpu_entry(); }