blob: 4ad40773870f4b07ac361fc108a9eb62b0d45872 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
/*
* Copyright (c) 2006-2025, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2025-04-20 GuEe-GUI The first version
*/
#include <sbi.h>
#include <cpu.h>
#include <cpuport.h>
static int sbi_cpu_boot(rt_uint32_t cpuid, rt_uint64_t entry)
{
rt_ubase_t hartid;
if (!riscv_cpu_id_available(cpuid))
{
return -RT_EINVAL;
}
hartid = riscv_cpu_id_to_hartid(cpuid);
return sbi_hsm_hart_start(hartid, entry, entry);
}
static void sbi_cpu_shutdown(void)
{
sbi_hsm_hart_stop();
}
struct cpu_ops_t cpu_sbi_ops =
{
.method = "sbi",
.cpu_boot = sbi_cpu_boot,
.cpu_shutdown = sbi_cpu_shutdown,
};
|