Skip to content

Commit d1ce4b3

Browse files
committed
[nrf fromlist] drivers: firmware: nrf_ironside: add IRONside CPUCONF service
Add an IPC service API for booting local domain cores. Upstream PR #: 88908 Signed-off-by: Sebastian Bøe <[email protected]>
1 parent 292e44a commit d1ce4b3

File tree

4 files changed

+122
-0
lines changed

4 files changed

+122
-0
lines changed

drivers/firmware/nrf_ironside/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
zephyr_library()
55

66
zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_CALL call.c)
7+
8+
zephyr_library_sources_ifdef(CONFIG_NRF_IRONSIDE_CPUCONF_SERVICE cpuconf.c)

drivers/firmware/nrf_ironside/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,15 @@ config NRF_IRONSIDE_CALL_INIT_PRIORITY
2020
but higher than the priority of any feature that selects NRF_IRONSIDE_CALL.
2121

2222
endif # NRF_IRONSIDE_CALL
23+
24+
menu "Nordic IRONside services"
25+
depends on SOC_NRF54H20_IRON
26+
27+
config NRF_IRONSIDE_CPUCONF_SERVICE
28+
bool "IRONside CPUCONF service"
29+
depends on SOC_NRF54H20_CPUAPP
30+
select NRF_IRONSIDE_CALL
31+
help
32+
Service used to boot local domain cores.
33+
34+
endmenu
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#include <stdint.h>
7+
#include <stdbool.h>
8+
9+
#include <zephyr/sys/util.h>
10+
#include <zephyr/kernel.h>
11+
12+
#include <nrfx.h>
13+
14+
#include <zephyr/drivers/firmware/nrf_ironside/call.h>
15+
#include <zephyr/drivers/firmware/nrf_ironside/cpuconf.h>
16+
17+
int ironside_cpuconf(NRF_PROCESSORID_Type cpu, void *vector_table, bool cpu_wait, uint8_t *msg,
18+
size_t msg_size)
19+
{
20+
int err;
21+
struct ironside_call_buf *const buf = ironside_call_alloc();
22+
23+
buf->id = IRONSIDE_CALL_ID_CPUCONF_V0;
24+
25+
buf->args[IRONSIDE_CPUCONF_SERVICE_CPU_IDX] = cpu;
26+
buf->args[IRONSIDE_CPUCONF_SERVICE_VECTOR_TABLE_IDX] = (uint32_t)vector_table;
27+
buf->args[IRONSIDE_CPUCONF_SERVICE_CPU_WAIT_IDX] = cpu_wait;
28+
buf->args[IRONSIDE_CPUCONF_SERVICE_MSG_IDX] = (uint32_t)msg;
29+
buf->args[IRONSIDE_CPUCONF_SERVICE_MSG_SIZE_IDX] = msg_size;
30+
31+
ironside_call_dispatch(buf);
32+
33+
if (buf->status == IRONSIDE_CALL_STATUS_RSP_SUCCESS) {
34+
err = buf->args[IRONSIDE_CPUCONF_SERVICE_RETCODE_IDX];
35+
} else {
36+
err = buf->status;
37+
}
38+
39+
ironside_call_release(buf);
40+
41+
return err;
42+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#ifndef ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_CPUCONF_H_
7+
#define ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_CPUCONF_H_
8+
9+
#include <zephyr/drivers/firmware/nrf_ironside/call.h>
10+
11+
#include <nrfx.h>
12+
13+
/**
14+
* @name CPUCONF service error codes.
15+
* @{
16+
*/
17+
18+
#define IRONSIDE_CPUCONF_ERROR_STARTING_CPU_FAILED 0x5eb0
19+
#define IRONSIDE_CPUCONF_ERROR_WRONG_CPU 0x5eb2
20+
#define IRONSIDE_CPUCONF_ERROR_MEM_ACCESS_NOT_PERMITTED 0x5eb1
21+
#define IRONSIDE_CPUCONF_ERROR_IRONSIDE_CALL_FAILED 0x5eb3
22+
23+
/**
24+
* @}
25+
*/
26+
27+
#define IRONSIDE_CALL_ID_CPUCONF_V0 2
28+
29+
enum {
30+
IRONSIDE_CPUCONF_SERVICE_CPU_IDX,
31+
IRONSIDE_CPUCONF_SERVICE_VECTOR_TABLE_IDX,
32+
IRONSIDE_CPUCONF_SERVICE_CPU_WAIT_IDX,
33+
IRONSIDE_CPUCONF_SERVICE_MSG_IDX,
34+
IRONSIDE_CPUCONF_SERVICE_MSG_SIZE_IDX,
35+
/* The last enum value is reserved for the number of arguments */
36+
IRONSIDE_SE_CPUCONF_NUM_ARGS
37+
};
38+
39+
/* IDX 0 is re-used by the error return code and the 'cpu' parameter. */
40+
#define IRONSIDE_CPUCONF_SERVICE_RETCODE_IDX 0
41+
42+
BUILD_ASSERT(IRONSIDE_SE_CPUCONF_NUM_ARGS <= NRF_IRONSIDE_CALL_NUM_ARGS);
43+
44+
/**
45+
* @brief Boot a local domain CPU
46+
*
47+
* @param cpu The CPU to be booted
48+
* @param vector_table Pointer to the vector table used to boot the CPU.
49+
* @param cpu_wait When this is true, the CPU will WAIT even if the CPU has clock.
50+
* @param msg A message that can be placed in radiocore's boot report.
51+
* @param msg_size Size of the message in bytes.
52+
*
53+
* @note cpu_wait is only intended to be enabled for debug purposes
54+
* and it is only supported that a debugger resumes the CPU.
55+
*
56+
* @retval 0 on success or if the CPU has already booted.
57+
* @retval -IRONSIDE_CPUCONF_ERROR_WRONG_CPU if cpu is unrecognized
58+
* @retval -IRONSIDE_CPUCONF_ERROR_STARTING_CPU_FAILED if starting the CPU failed
59+
* @retval -IRONSIDE_CPUCONF_ERROR_MEM_ACCESS_NOT_PERMITTED
60+
* if the CPU does not have read access configured for the vector_table address
61+
* @retval -IRONSIDE_CPUCONF_ERROR_IRONSIDE_CALL_FAILED The IRONside call failed.
62+
*/
63+
int ironside_cpuconf(NRF_PROCESSORID_Type cpu, void *vector_table, bool cpu_wait, uint8_t *msg,
64+
size_t msg_size);
65+
66+
#endif /* ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_CPUCONF_H_ */

0 commit comments

Comments
 (0)