diff --git a/kernel/drivers/opensbi/extensions/ipi.cpp b/kernel/drivers/opensbi/extensions/ipi.cpp new file mode 100644 index 0000000..748aa11 --- /dev/null +++ b/kernel/drivers/opensbi/extensions/ipi.cpp @@ -0,0 +1,28 @@ +#include "opensbi/extensions/ipi.h" + +namespace drivers { +namespace opensbi::ipi { + + namespace { + enum class ExtensionId { + IPI = 0x735049 + }; + + enum class FunctionId { + SEND_IPI + }; + } + + SbiRet send_ipi( + unsigned long hart_mask, + unsigned long hart_mask_base) { + return ecall( + static_cast(ExtensionId::IPI), + static_cast(FunctionId::SEND_IPI), + hart_mask, + hart_mask_base); + } + +} // End namespace opensbi::ipi +} // End namespace drivers + diff --git a/kernel/drivers/opensbi/include/opensbi/extensions/ipi.h b/kernel/drivers/opensbi/include/opensbi/extensions/ipi.h new file mode 100644 index 0000000..1060a29 --- /dev/null +++ b/kernel/drivers/opensbi/include/opensbi/extensions/ipi.h @@ -0,0 +1,13 @@ +#pragma once + +#include "opensbi/opensbi.h" + +namespace drivers { +namespace opensbi::ipi { + + SbiRet send_ipi( + unsigned long hart_mask, + unsigned long hart_mask_base); + +} // End namespace opensbi::ipi +} // End namespace drivers diff --git a/kernel/drivers/opensbi/meson.build b/kernel/drivers/opensbi/meson.build index b05f485..9f67dd8 100644 --- a/kernel/drivers/opensbi/meson.build +++ b/kernel/drivers/opensbi/meson.build @@ -3,7 +3,8 @@ kernel_sources += [ 'opensbi.cpp', 'extensions/legacy.cpp', 'extensions/base.cpp', - 'extensions/timer.cpp' + 'extensions/timer.cpp', + 'extensions/ipi.cpp' ), ]