| 325 | |
| 326 | #ifdef RT_USING_SMP |
| 327 | rt_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 | |
| 370 | rt_weak void rt_hw_secondary_cpu_bsp_start(void) |
| 371 | { |
no test coverage detected