|
6 | 6 |
|
7 | 7 | #include <suit_cpu_run.h> |
8 | 8 | #include <zephyr/logging/log.h> |
9 | | -#include <suit_platform_internal.h> |
10 | 9 | #include <drivers/nrfx_common.h> |
| 10 | + |
| 11 | +#ifdef CONFIG_SDFW_VPRS |
11 | 12 | #include <sdfw/vprs.h> |
| 13 | +#endif /* CONFIG_SDFW_VPRS */ |
12 | 14 |
|
13 | 15 | #ifdef CONFIG_SDFW_RESET_HANDLING_ENABLED |
14 | 16 | #include <sdfw/reset_mgr.h> |
15 | 17 | #endif /* CONFIG_SDFW_RESET_HANDLING_ENABLED */ |
16 | 18 |
|
17 | 19 | LOG_MODULE_REGISTER(suit_plat_run, CONFIG_SUIT_LOG_LEVEL); |
18 | 20 |
|
19 | | -int suit_plat_cpu_run(uint8_t cpu_id, intptr_t run_address) |
| 21 | +suit_plat_err_t suit_plat_cpu_run(uint8_t cpu_id, uintptr_t run_address) |
20 | 22 | { |
| 23 | + int ret = 0; |
| 24 | + |
21 | 25 | switch (cpu_id) { |
22 | 26 | case NRF_PROCESSOR_APPLICATION: /* AppCore */ |
23 | | - case NRF_PROCESSOR_RADIOCORE: { /* RadioCore */ |
| 27 | + case NRF_PROCESSOR_RADIOCORE: /* RadioCore */ |
24 | 28 | #ifdef CONFIG_SDFW_RESET_HANDLING_ENABLED |
| 29 | + LOG_INF("Starting Cortex core %d from address 0x%lx", cpu_id, run_address); |
25 | 30 | /* Single run address implies no NSVTOR, so keep at reset value of 0x0. */ |
26 | | - return reset_mgr_init_and_boot_processor(cpu_id, run_address, 0); |
27 | | -#else |
28 | | - return SUIT_SUCCESS; |
| 31 | + ret = reset_mgr_init_and_boot_processor(cpu_id, run_address, 0); |
| 32 | +#else /* CONFIG_SDFW_RESET_HANDLING_ENABLED */ |
| 33 | + LOG_WRN("Cortex core handling not supported - skip CPU %d start", cpu_id); |
29 | 34 | #endif /* CONFIG_SDFW_RESET_HANDLING_ENABLED */ |
30 | | - } break; |
31 | | - |
32 | | - case NRF_PROCESSOR_BBPR: { /* BBPR - Baseband Processor */ |
33 | | - LOG_ERR("No implementation for BBPR invoke"); |
34 | | - return SUIT_ERR_UNSUPPORTED_PARAMETER; |
35 | | - } break; |
| 35 | + break; |
36 | 36 |
|
37 | | - case NRF_PROCESSOR_SYSCTRL: { /* SysCtrl */ |
| 37 | + case NRF_PROCESSOR_SYSCTRL: /* SysCtrl */ |
| 38 | +#ifdef CONFIG_SDFW_VPRS |
38 | 39 | LOG_INF("Starting SysCtrl from address 0x%lx", run_address); |
39 | | - return vprs_sysctrl_start((uintptr_t)run_address); |
40 | | - } break; |
41 | | - |
42 | | - case NRF_PROCESSOR_PPR: /* PPR(VPR) */ |
43 | | - case NRF_PROCESSOR_FLPR: { /* FLPR(VPR) */ |
44 | | - LOG_ERR("No implementation for VPR invoke"); |
45 | | - return SUIT_ERR_UNSUPPORTED_PARAMETER; |
46 | | - } break; |
47 | | - |
48 | | - default: { |
49 | | - LOG_ERR("Unsupported CPU ID"); |
50 | | - return SUIT_ERR_UNSUPPORTED_PARAMETER; |
| 40 | + ret = vprs_sysctrl_start((uintptr_t)run_address); |
| 41 | +#else /* CONFIG_SDFW_VPRS */ |
| 42 | + LOG_WRN("SysCtrl core handling not supported - skip VPR start"); |
| 43 | +#endif /* CONFIG_SDFW_VPRS */ |
| 44 | + break; |
| 45 | + |
| 46 | + case NRF_PROCESSOR_PPR: /* PPR(VPR) */ |
| 47 | + case NRF_PROCESSOR_FLPR: /* FLPR(VPR) */ |
| 48 | + LOG_ERR("Application VPR %d start is not supported in SUIT", cpu_id); |
| 49 | + return SUIT_PLAT_ERR_UNSUPPORTED; |
| 50 | + |
| 51 | + default: |
| 52 | + LOG_ERR("Unsupported CPU ID: %d", cpu_id); |
| 53 | + return SUIT_PLAT_ERR_INVAL; |
51 | 54 | } |
| 55 | + |
| 56 | + if (ret != 0) { |
| 57 | + LOG_ERR("Failed to start CPU %d from address 0x%lx (err: %d)", cpu_id, run_address, |
| 58 | + ret); |
| 59 | + return SUIT_PLAT_ERR_CRASH; |
52 | 60 | } |
| 61 | + |
| 62 | + return SUIT_PLAT_SUCCESS; |
53 | 63 | } |
0 commit comments