MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_hw_secondary_cpu_up

Function rt_hw_secondary_cpu_up

libcpu/aarch64/common/setup.c:327–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

325
326#ifdef RT_USING_SMP
327rt_weak void rt_hw_secondary_cpu_up(void)
328{
329 int cpu_id = rt_hw_cpu_id();
330 rt_uint64_t entry = (rt_uint64_t)rt_kmem_v2p(_secondary_cpu_entry);
331
332 if (!entry)
333 {
334 LOG_E("Failed to translate '_secondary_cpu_entry' to physical address");
335 RT_ASSERT(0);
336 }
337
338 /* Maybe we are no in the first cpu */
339 for (int i = 0; i < RT_ARRAY_SIZE(cpu_np); ++i)
340 {
341 int err;
342 const char *enable_method;
343
344 if (!cpu_np[i] || i == cpu_id)
345 {
346 continue;
347 }
348
349 err = rt_ofw_prop_read_string(cpu_np[i], "enable-method", &enable_method);
350
351 for (int idx = 0; !err && idx < RT_ARRAY_SIZE(cpu_ops); ++idx)
352 {
353 struct cpu_ops_t *ops = cpu_ops[idx];
354
355 if (ops->method && !rt_strcmp(ops->method, enable_method) && ops->cpu_boot)
356 {
357 err = ops->cpu_boot(i, entry);
358
359 break;
360 }
361 }
362
363 if (err)
364 {
365 LOG_W("Call cpu %d on %s", i, "failed");
366 }
367 }
368}
369
370rt_weak void rt_hw_secondary_cpu_bsp_start(void)
371{

Callers 1

main_thread_entryFunction · 0.50

Calls 4

rt_kmem_v2pFunction · 0.85
rt_ofw_prop_read_stringFunction · 0.85
rt_strcmpFunction · 0.85
rt_hw_cpu_idFunction · 0.50

Tested by

no test coverage detected