Skip to content

Commit b11e685

Browse files
SebastianBoejonathannilsen
authored andcommitted
[nrf fromlist] drivers: firmware: nrf_ironside: add IRONside CPUCONF service
Upstream PR #: 89333 Add an IPC service API for booting local domain cores. Signed-off-by: Sebastian Bøe <[email protected]>
1 parent 966649d commit b11e685

File tree

4 files changed

+117
-0
lines changed

4 files changed

+117
-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
@@ -26,3 +26,15 @@ config NRF_IRONSIDE_CALL_INIT_PRIORITY
2626
but higher than the priority of any feature that selects NRF_IRONSIDE_CALL.
2727

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

0 commit comments

Comments
 (0)