QTechOS/kernel/drivers/opensbi/extensions/base.cpp

68 lines
1.7 KiB
C++
Raw Permalink Normal View History

#include "opensbi/extensions/base.h"
namespace drivers {
namespace opensbi::base {
namespace {
enum class ExtensionId {
BASE = 0x10
};
enum class FunctionId {
GET_SPEC_VERSION,
GET_IMPL_ID,
GET_IMPL_VERSION,
PROBE_EXTENSION,
GET_MVENDORID,
GET_MARCHID,
GET_MIMPID
};
}
SbiRet get_spec_version() {
return ecall(
static_cast<sbiword_t>(ExtensionId::BASE),
static_cast<sbiword_t>(FunctionId::GET_SPEC_VERSION));
}
SbiRet get_impl_id() {
return ecall(
static_cast<sbiword_t>(ExtensionId::BASE),
static_cast<sbiword_t>(FunctionId::GET_IMPL_ID));
}
SbiRet get_impl_version() {
return ecall(
static_cast<sbiword_t>(ExtensionId::BASE),
static_cast<sbiword_t>(FunctionId::GET_IMPL_VERSION));
}
SbiRet probe_extension(long extension_id) {
return ecall(
static_cast<sbiword_t>(ExtensionId::BASE),
static_cast<sbiword_t>(FunctionId::PROBE_EXTENSION),
extension_id);
}
SbiRet get_mvendor_id() {
return ecall(
static_cast<sbiword_t>(ExtensionId::BASE),
static_cast<sbiword_t>(FunctionId::GET_MVENDORID));
}
SbiRet get_march_id() {
return ecall(
static_cast<sbiword_t>(ExtensionId::BASE),
static_cast<sbiword_t>(FunctionId::GET_MARCHID));
}
SbiRet get_mimp_id() {
return ecall(
static_cast<sbiword_t>(ExtensionId::BASE),
static_cast<sbiword_t>(FunctionId::GET_MIMPID));
}
} // End namespace opensbi::base
} // End namespace drivers