aboutsummaryrefslogtreecommitdiff
path: root/kapi
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-04-10 09:01:59 +0200
committerFelix Morgner <felix.morgner@ost.ch>2026-04-10 09:01:59 +0200
commit3ad230fab8dc17758559aac3c20ba67a8c619878 (patch)
tree8bdac1645e79677acb1e359ddae944dfb9d5a2b2 /kapi
parent65fe71d4c2cc4fa7b09a83671dccb5d4483f0524 (diff)
downloadteachos-3ad230fab8dc17758559aac3c20ba67a8c619878.tar.xz
teachos-3ad230fab8dc17758559aac3c20ba67a8c619878.zip
kapi: move platform functions to CPU
Diffstat (limited to 'kapi')
-rw-r--r--kapi/include/kapi/cpu.hpp20
-rw-r--r--kapi/include/kapi/platform.hpp34
2 files changed, 20 insertions, 34 deletions
diff --git a/kapi/include/kapi/cpu.hpp b/kapi/include/kapi/cpu.hpp
index d90365a..c643cd7 100644
--- a/kapi/include/kapi/cpu.hpp
+++ b/kapi/include/kapi/cpu.hpp
@@ -1,10 +1,13 @@
#ifndef TEACHOS_KAPI_CPU_HPP
#define TEACHOS_KAPI_CPU_HPP
+#include "kapi/devices.hpp"
#include "kapi/memory.hpp"
#include <kstd/format>
+#include <kstd/memory>
+#include <cstddef>
#include <cstdint>
namespace kapi::cpu
@@ -72,6 +75,17 @@ namespace kapi::cpu
//! @return Whether the exception was handled.
[[nodiscard]] auto dispatch(exception const & context) -> bool;
+ //! A hook that is called when the platform detects a CPU core during topology discovery.
+ //!
+ //! @param bus The bus the CPU was detected on.
+ //! @param major The major number of the CPU device.
+ //! @param minor The minor number of the CPU device.
+ //! @param hardware_id The hardware specific ID of the CPU core.
+ //! @param is_bsp Whether the reported CPU is the the bootstrap processor.
+ //! @param core_interrupt_controller The local interrupt controller of this CPU core.
+ auto core_detected(kapi::devices::bus & bus, std::size_t major, std::size_t minor, std::uint64_t hardware_id,
+ bool is_bsp, kstd::unique_ptr<devices::device> core_interrupt_controller) -> bool;
+
//! @}
//! @addtogroup kapi-cpu-platform-defined
@@ -88,6 +102,12 @@ namespace kapi::cpu
//! interrupts itself.
auto init() -> void;
+ //! Discover the CPU topology of the platform and attach it to the given CPU bus.
+ //!
+ //! @param bus The bus to attach the CPU topology to.
+ //! @return true iff. the CPU topology was discovered successfully, false otherwise.
+ auto discover_topology(kapi::devices::bus & bus) -> bool;
+
//! @}
} // namespace kapi::cpu
diff --git a/kapi/include/kapi/platform.hpp b/kapi/include/kapi/platform.hpp
deleted file mode 100644
index e1e267e..0000000
--- a/kapi/include/kapi/platform.hpp
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef TEACHOS_KAPI_PLATFORM_HPP
-#define TEACHOS_KAPI_PLATFORM_HPP
-
-#include "kapi/devices.hpp"
-
-#include <kstd/memory>
-
-#include <cstddef>
-#include <cstdint>
-
-namespace kapi::platform
-{
-
- //! @addtogroup kapi-platform-kernel-defined
- //! @{
-
- auto cpu_detected(kapi::devices::bus & bus, std::size_t major, std::size_t minor, std::uint64_t hardware_id,
- bool is_bsp, kstd::unique_ptr<devices::device> core_interrupt_controller) -> bool;
- //! @}
-
- //! @addtogroup kapi-platform-platform-defined
- //! @{
-
- //! Discover the CPU topology of the platform and attach it to the given CPU bus.
- //!
- //! @param bus The bus to attach the CPU topology to.
- //! @return true iff. the CPU topology was discovered successfully, false otherwise.
- auto discover_cpu_topology(kapi::devices::bus & bus) -> bool;
-
- //! @}
-
-} // namespace kapi::platform
-
-#endif \ No newline at end of file