116 lines
3.2 KiB
C++
116 lines
3.2 KiB
C++
#include "opensbi/extensions/rfence.h"
|
|
|
|
namespace drivers {
|
|
namespace opensbi::rfence {
|
|
|
|
namespace {
|
|
enum class ExtensionId {
|
|
RFENCE = 0x52464E43
|
|
};
|
|
|
|
enum class FunctionId {
|
|
REMOTE_FENCE_I,
|
|
REMOTE_SFENCE_VMA,
|
|
REMOTE_SFENCE_VMA_ASID,
|
|
REMOTE_HFENCE_GVMA_VMID,
|
|
REMOTE_HFENCE_GVMA,
|
|
REMOTE_HFENCE_VVMA_ASID,
|
|
REMOTE_HFENCE_VVMA
|
|
};
|
|
}
|
|
|
|
SbiRet remote_fence_i(HartMask hart_mask) {
|
|
return ecall(
|
|
static_cast<sbiword_t>(ExtensionId::RFENCE),
|
|
static_cast<sbiword_t>(FunctionId::REMOTE_FENCE_I),
|
|
hart_mask.mask,
|
|
hart_mask.base);
|
|
}
|
|
|
|
SbiRet remote_sfence_vma(
|
|
HartMask hart_mask,
|
|
unsigned long start_addr,
|
|
unsigned long size) {
|
|
return ecall(
|
|
static_cast<sbiword_t>(ExtensionId::RFENCE),
|
|
static_cast<sbiword_t>(FunctionId::REMOTE_SFENCE_VMA),
|
|
hart_mask.mask,
|
|
hart_mask.base,
|
|
start_addr,
|
|
size);
|
|
}
|
|
|
|
SbiRet remote_sfence_vma_asid(
|
|
HartMask hart_mask,
|
|
unsigned long start_addr,
|
|
unsigned long size,
|
|
unsigned long asid) {
|
|
return ecall(
|
|
static_cast<sbiword_t>(ExtensionId::RFENCE),
|
|
static_cast<sbiword_t>(FunctionId::REMOTE_SFENCE_VMA_ASID),
|
|
hart_mask.mask,
|
|
hart_mask.base,
|
|
start_addr,
|
|
size,
|
|
asid);
|
|
}
|
|
|
|
SbiRet remote_hfence_gvma_vmid(
|
|
HartMask hart_mask,
|
|
unsigned long start_addr,
|
|
unsigned long size,
|
|
unsigned long vmid) {
|
|
return ecall(
|
|
static_cast<sbiword_t>(ExtensionId::RFENCE),
|
|
static_cast<sbiword_t>(FunctionId::REMOTE_HFENCE_GVMA_VMID),
|
|
hart_mask.mask,
|
|
hart_mask.base,
|
|
start_addr,
|
|
size,
|
|
vmid);
|
|
}
|
|
|
|
SbiRet remote_hfence_gvma(
|
|
HartMask hart_mask,
|
|
unsigned long start_addr,
|
|
unsigned long size) {
|
|
return ecall(
|
|
static_cast<sbiword_t>(ExtensionId::RFENCE),
|
|
static_cast<sbiword_t>(FunctionId::REMOTE_HFENCE_GVMA),
|
|
hart_mask.mask,
|
|
hart_mask.base,
|
|
start_addr,
|
|
size);
|
|
}
|
|
|
|
SbiRet remote_hfence_vvma_asid(
|
|
HartMask hart_mask,
|
|
unsigned long start_addr,
|
|
unsigned long size,
|
|
unsigned long asid) {
|
|
return ecall(
|
|
static_cast<sbiword_t>(ExtensionId::RFENCE),
|
|
static_cast<sbiword_t>(FunctionId::REMOTE_HFENCE_VVMA_ASID),
|
|
hart_mask.mask,
|
|
hart_mask.base,
|
|
start_addr,
|
|
size,
|
|
asid);
|
|
}
|
|
|
|
SbiRet remote_hfence_vvma(
|
|
HartMask hart_mask,
|
|
unsigned long start_addr,
|
|
unsigned long size) {
|
|
return ecall(
|
|
static_cast<sbiword_t>(ExtensionId::RFENCE),
|
|
static_cast<sbiword_t>(FunctionId::REMOTE_HFENCE_VVMA),
|
|
hart_mask.mask,
|
|
hart_mask.base,
|
|
start_addr,
|
|
size);
|
|
}
|
|
|
|
} // End namespace opensbi::rfence
|
|
} // End namespace drivers
|
|
|