OpenSBI: FunctionId in legacy extension, see previous commit
This commit is contained in:
parent
b08ac4817c
commit
dd373fca85
1 changed files with 14 additions and 10 deletions
|
@ -15,18 +15,22 @@ namespace opensbi::legacy {
|
||||||
REMOTE_SFENCE_VMA_ASID,
|
REMOTE_SFENCE_VMA_ASID,
|
||||||
SHUTDOWN
|
SHUTDOWN
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class Functionid {
|
||||||
|
UNUSED
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
SbiRet set_timer(std::uint64_t stime_value) {
|
SbiRet set_timer(std::uint64_t stime_value) {
|
||||||
#if __riscv_xlen == 64
|
#if __riscv_xlen == 64
|
||||||
return ecall(
|
return ecall(
|
||||||
static_cast<sbiword_t>(ExtensionId::SET_TIMER),
|
static_cast<sbiword_t>(ExtensionId::SET_TIMER),
|
||||||
0,
|
static_cast<sbiword_t>(Functionid::UNUSED),
|
||||||
stime_value);
|
stime_value);
|
||||||
#else
|
#else
|
||||||
return ecall(
|
return ecall(
|
||||||
static_cast<sbiword_t>(ExtensionId::SET_TIMER),
|
static_cast<sbiword_t>(ExtensionId::SET_TIMER),
|
||||||
0,
|
static_cast<sbiword_t>(Functionid::UNUSED),
|
||||||
static_cast<uint32_t>(stime_value),
|
static_cast<uint32_t>(stime_value),
|
||||||
static_cast<uint32_t>(stime_value >> 32));
|
static_cast<uint32_t>(stime_value >> 32));
|
||||||
#endif
|
#endif
|
||||||
|
@ -35,33 +39,33 @@ namespace opensbi::legacy {
|
||||||
SbiRet console_putchar(int ch) {
|
SbiRet console_putchar(int ch) {
|
||||||
return ecall(
|
return ecall(
|
||||||
static_cast<sbiword_t>(ExtensionId::CONSOLE_PUTCHAR),
|
static_cast<sbiword_t>(ExtensionId::CONSOLE_PUTCHAR),
|
||||||
0,
|
static_cast<sbiword_t>(Functionid::UNUSED),
|
||||||
ch);
|
ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
SbiRet console_getchar() {
|
SbiRet console_getchar() {
|
||||||
return ecall(
|
return ecall(
|
||||||
static_cast<sbiword_t>(ExtensionId::CONSOLE_GETCHAR),
|
static_cast<sbiword_t>(ExtensionId::CONSOLE_GETCHAR),
|
||||||
0);
|
static_cast<sbiword_t>(Functionid::UNUSED));
|
||||||
}
|
}
|
||||||
|
|
||||||
SbiRet clear_ipmi() {
|
SbiRet clear_ipmi() {
|
||||||
return ecall(
|
return ecall(
|
||||||
static_cast<sbiword_t>(ExtensionId::CLEAR_IPI),
|
static_cast<sbiword_t>(ExtensionId::CLEAR_IPI),
|
||||||
0);
|
static_cast<sbiword_t>(Functionid::UNUSED));
|
||||||
}
|
}
|
||||||
|
|
||||||
SbiRet send_ipmi(hart_mask_t hart_mask) {
|
SbiRet send_ipmi(hart_mask_t hart_mask) {
|
||||||
return ecall(
|
return ecall(
|
||||||
static_cast<sbiword_t>(ExtensionId::SEND_IPI),
|
static_cast<sbiword_t>(ExtensionId::SEND_IPI),
|
||||||
0,
|
static_cast<sbiword_t>(Functionid::UNUSED),
|
||||||
reinterpret_cast<sbiword_t>(hart_mask));
|
reinterpret_cast<sbiword_t>(hart_mask));
|
||||||
}
|
}
|
||||||
|
|
||||||
SbiRet remote_fence_i(hart_mask_t hart_mask) {
|
SbiRet remote_fence_i(hart_mask_t hart_mask) {
|
||||||
return ecall(
|
return ecall(
|
||||||
static_cast<sbiword_t>(ExtensionId::REMOTE_FENCE_I),
|
static_cast<sbiword_t>(ExtensionId::REMOTE_FENCE_I),
|
||||||
0,
|
static_cast<sbiword_t>(Functionid::UNUSED),
|
||||||
reinterpret_cast<sbiword_t>(hart_mask));
|
reinterpret_cast<sbiword_t>(hart_mask));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +75,7 @@ namespace opensbi::legacy {
|
||||||
sbiword_t size) {
|
sbiword_t size) {
|
||||||
return ecall(
|
return ecall(
|
||||||
static_cast<sbiword_t>(ExtensionId::REMOTE_SFENCE_VMA),
|
static_cast<sbiword_t>(ExtensionId::REMOTE_SFENCE_VMA),
|
||||||
0,
|
static_cast<sbiword_t>(Functionid::UNUSED),
|
||||||
reinterpret_cast<sbiword_t>(hart_mask),
|
reinterpret_cast<sbiword_t>(hart_mask),
|
||||||
start,
|
start,
|
||||||
size);
|
size);
|
||||||
|
@ -84,7 +88,7 @@ namespace opensbi::legacy {
|
||||||
sbiword_t asid) {
|
sbiword_t asid) {
|
||||||
return ecall(
|
return ecall(
|
||||||
static_cast<sbiword_t>(ExtensionId::REMOTE_SFENCE_VMA_ASID),
|
static_cast<sbiword_t>(ExtensionId::REMOTE_SFENCE_VMA_ASID),
|
||||||
0,
|
static_cast<sbiword_t>(Functionid::UNUSED),
|
||||||
reinterpret_cast<sbiword_t>(hart_mask),
|
reinterpret_cast<sbiword_t>(hart_mask),
|
||||||
start,
|
start,
|
||||||
size,
|
size,
|
||||||
|
@ -94,7 +98,7 @@ namespace opensbi::legacy {
|
||||||
void shutdown() {
|
void shutdown() {
|
||||||
ecall(
|
ecall(
|
||||||
static_cast<sbiword_t>(ExtensionId::SHUTDOWN),
|
static_cast<sbiword_t>(ExtensionId::SHUTDOWN),
|
||||||
0);
|
static_cast<sbiword_t>(Functionid::UNUSED));
|
||||||
|
|
||||||
// This should never be reached, explode if it is
|
// This should never be reached, explode if it is
|
||||||
__builtin_trap();
|
__builtin_trap();
|
||||||
|
|
Loading…
Reference in a new issue