Skip to content

Commit 960f5b4

Browse files
committed
ironside: se: Add support for calling the cpuconf service
Add support for calling the cpuconf service. Ref: NCSDK-32925 Signed-off-by: Sebastian Bøe <[email protected]>
1 parent c90f6c4 commit 960f5b4

File tree

8 files changed

+119
-1
lines changed

8 files changed

+119
-1
lines changed

CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@
368368
/include/nrf_compress/ @nordicjm
369369
/include/nrf_rpc/ @nrfconnect/ncs-co-drivers @nrfconnect/ncs-si-muffin @nrfconnect/ncs-protocols-serialization
370370
/include/power/ @nrfconnect/ncs-co-drivers
371+
/include/ironside/ @nrfconnect/ncs-aurora
371372
/include/sdfw/ @nrfconnect/ncs-aurora
372373
/include/sdfw/sdfw_services/extmem_remote.h @nrfconnect/ncs-charon
373374
/include/sdfw/sdfw_services/suit_service.h @nrfconnect/ncs-charon
@@ -389,6 +390,7 @@
389390
/lib/bin/lwm2m_carrier/ @nrfconnect/ncs-carrier
390391
/lib/boot_banner/ @nordicjm
391392
/lib/contin_array/ @nrfconnect/ncs-audio
393+
/lib/cpuconf/ @nrfconnect/ncs-aurora
392394
/lib/data_fifo/ @nrfconnect/ncs-audio
393395
/lib/date_time/ @nrfconnect/ncs-modem-tre
394396
/lib/dk_buttons_and_leds/ @nrfconnect/ncs-si-muffin

include/ironside/se/cpuconf.h

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
#ifndef __CPUCONF_H__
8+
#define __CPUCONF_H__
9+
10+
#include <zephyr/drivers/firmware/nrf_ironside/call.h>
11+
12+
#define IRONSIDE_SE_CPUCONF_SERVICE_WRONG_CPU 0x5eb2
13+
#define IRONSIDE_SE_CPUCONF_SERVICE_STARTING_CPU_FAILED 0x5eb0
14+
#define IRONSIDE_SE_CPUCONF_SERVICE_MEM_ACCESS_NOT_PERMITTED 0x5eb1
15+
16+
#define IRONSIDE_CALL_ID_CPUCONF_V0 2
17+
18+
enum {
19+
IRONSIDE_SE_CPUCONF_INDEX_CPU,
20+
IRONSIDE_SE_CPUCONF_INDEX_VECTOR_TABLE,
21+
IRONSIDE_SE_CPUCONF_INDEX_CPU_WAIT,
22+
IRONSIDE_SE_CPUCONF_INDEX_MSG,
23+
IRONSIDE_SE_CPUCONF_INDEX_MSG_SIZE,
24+
IRONSIDE_SE_CPUCONF_INDEX_ERR,
25+
/* The last enum value is reserved for the number of arguments */
26+
IRONSIDE_SE_CPUCONF_NUM_ARGS
27+
};
28+
29+
BUILD_ASSERT(IRONSIDE_SE_CPUCONF_NUM_ARGS <= NRF_IRONSIDE_CALL_NUM_ARGS);
30+
31+
/**
32+
* @brief Boot a local domain CPU
33+
*
34+
* @param cpu The CPU to be booted
35+
* @param vector_table Pointer to the vector table used to boot the CPU.
36+
* @param cpu_wait When this is true, the CPU will WAIT even if the CPU has clock.
37+
* @param msg A message that can be placed in radiocore's boot report.
38+
* @param msg_size Size of the message in bytes.
39+
*
40+
* @note cpu_wait is only intended to be enabled for debug purposes
41+
* and it is only supported that a debugger resumes the CPU.
42+
*
43+
* @retval 0 on success or if the CPU has already booted.
44+
* @retval -IRONSIDE_SE_CPUCONF_SERVICE_WRONG_CPU if cpu is unrecognized
45+
* @retval -IRONSIDE_SE_CPUCONF_SERVICE_STARTING_CPU_FAILED if starting the CPU failed
46+
* @retval -IRONSIDE_SE_CPUCONF_SERVICE_MEM_ACCESS_NOT_PERMITTED
47+
* if the CPU does not have read access configured for the vector_table address
48+
*/
49+
int ironside_se_cpuconf_boot_core(NRF_PROCESSORID_Type cpu, void *vector_table, bool cpu_wait, uint8_t *msg, size_t msg_size);
50+
51+
#endif /* __CPUCONF_SERVICE_H__ */

lib/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ add_subdirectory_ifdef(CONFIG_HW_UNIQUE_KEY_SRC hw_unique_key)
3636
add_subdirectory_ifdef(CONFIG_APP_JWT app_jwt)
3737
add_subdirectory_ifdef(CONFIG_MODEM_JWT modem_jwt)
3838
add_subdirectory_ifdef(CONFIG_MODEM_SLM modem_slm)
39+
add_subdirectory_ifdef(CONFIG_IRONSIDE_SE_CPUCONF cpuconf)
3940
add_subdirectory_ifdef(CONFIG_MODEM_ATTEST_TOKEN modem_attest_token)
4041
add_subdirectory_ifdef(CONFIG_LOCATION location)
4142
add_subdirectory_ifdef(CONFIG_AT_SHELL at_shell)

lib/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ rsource "hw_unique_key/Kconfig"
3838
rsource "modem_jwt/Kconfig"
3939
rsource "modem_slm/Kconfig"
4040
rsource "modem_attest_token/Kconfig"
41+
rsource "cpuconf/Kconfig"
4142
rsource "location/Kconfig"
4243
rsource "at_shell/Kconfig"
4344
rsource "modem_antenna/Kconfig"

lib/cpuconf/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
zephyr_library()
8+
zephyr_library_sources(cpuconf.c)

lib/cpuconf/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
config IRONSIDE_SE_CPUCONF
8+
bool "CPUCONF"
9+
depends on SOC_NRF54H20_CPUAPP
10+
select NRF_IRONSIDE_CALL

lib/cpuconf/cpuconf.c

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
#include <stdint.h>
8+
#include <stdbool.h>
9+
10+
#include <zephyr/sys/util.h>
11+
12+
#include <nrfx.h>
13+
#include <ironside/se/cpuconf.h> // Will be moved to Zephyr
14+
15+
#include <zephyr/drivers/firmware/nrf_ironside/call.h>
16+
17+
int ironside_se_cpuconf_boot_core(NRF_PROCESSORID_Type cpu, void *vector_table, bool cpu_wait, uint8_t *msg, size_t msg_size)
18+
{
19+
ARG_UNUSED(msg);
20+
ARG_UNUSED(msg_size);
21+
22+
/* NCSDK-32393: msg is unused until the boot report is available */
23+
24+
struct ironside_call_buf *const buf = ironside_call_alloc();
25+
26+
buf->id = IRONSIDE_CALL_ID_CPUCONF_V0;
27+
28+
buf->args[IRONSIDE_SE_CPUCONF_INDEX_CPU] = cpu;
29+
buf->args[IRONSIDE_SE_CPUCONF_INDEX_VECTOR_TABLE] = (uint32_t)vector_table;
30+
buf->args[IRONSIDE_SE_CPUCONF_INDEX_CPU_WAIT] = cpu_wait;
31+
buf->args[IRONSIDE_SE_CPUCONF_INDEX_MSG] = (uint32_t)msg;
32+
buf->args[IRONSIDE_SE_CPUCONF_INDEX_MSG_SIZE] = msg_size;
33+
34+
ironside_call_dispatch(buf);
35+
36+
int err = -1; // TODO COMM_FAILURE
37+
38+
if (buf->status == IRONSIDE_CALL_STATUS_RSP_SUCCESS) {
39+
err = buf->args[IRONSIDE_SE_CPUCONF_INDEX_ERR];
40+
}
41+
42+
ironside_call_release(buf);
43+
44+
return err;
45+
}

west.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ manifest:
6565
# https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/modules.html
6666
- name: zephyr
6767
repo-path: sdk-zephyr
68-
revision: ca2af2f1469802d7e48b18a6e8bce6436d57223c
68+
revision: pull/2815/head
6969
import:
7070
# In addition to the zephyr repository itself, NCS also
7171
# imports the contents of zephyr/west.yml at the above

0 commit comments

Comments
 (0)