diff options
Diffstat (limited to 'kapi')
| -rw-r--r-- | kapi/kapi/cpu.hpp | 5 | ||||
| -rw-r--r-- | kapi/kapi/devices.hpp | 12 | ||||
| -rw-r--r-- | kapi/kapi/devices/cpu.hpp | 35 |
3 files changed, 10 insertions, 42 deletions
diff --git a/kapi/kapi/cpu.hpp b/kapi/kapi/cpu.hpp index 9a50f67e..7337a45a 100644 --- a/kapi/kapi/cpu.hpp +++ b/kapi/kapi/cpu.hpp @@ -101,11 +101,6 @@ namespace kapi::cpu //! interrupts itself. auto init() -> void; - //! Discover the CPU topology of the platform and attach it to the given CPU bus. - //! - //! @return true iff. the CPU topology was discovered successfully, false otherwise. - auto discover_topology() -> bool; - //! Get the current CPU id. //! //! @return The id of the CPU core currently executing the call to this function. diff --git a/kapi/kapi/devices.hpp b/kapi/kapi/devices.hpp index 8c0c238e..b20e3546 100644 --- a/kapi/kapi/devices.hpp +++ b/kapi/kapi/devices.hpp @@ -1,10 +1,8 @@ #ifndef TEACHOS_KAPI_DEVICES_HPP #define TEACHOS_KAPI_DEVICES_HPP -#include <kapi/capabilities/facet_id.hpp> // IWYU pragma: export #include <kapi/devices/bus.hpp> // IWYU pragma: export #include <kapi/devices/bus_protocol.hpp> // IWYU pragma: export -#include <kapi/devices/cpu.hpp> // IWYU pragma: export #include <kapi/devices/device.hpp> // IWYU pragma: export #include <kapi/devices/device_registry.hpp> // IWYU pragma: export #include <kapi/devices/driver.hpp> // IWYU pragma: export @@ -75,6 +73,16 @@ namespace kapi::devices //! Initialize the platform's device tree. auto init_platform_devices() -> void; + //! Discover the platform's CPU topology + auto discover_cpu_topology() -> void; + + //! Get the virtual system CPU bus. + //! + //! @warning This function will panic if the CPU topology has not been discovered. + //! + //! @return a shared pointer to the CPU bus. + auto get_cpu_bus() -> kstd::shared_ptr<bus>; + //! @} } // namespace kapi::devices diff --git a/kapi/kapi/devices/cpu.hpp b/kapi/kapi/devices/cpu.hpp deleted file mode 100644 index 708c803e..00000000 --- a/kapi/kapi/devices/cpu.hpp +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef TEACHOS_KAPI_DEVICES_CPU_HPP -#define TEACHOS_KAPI_DEVICES_CPU_HPP - -#include <kapi/devices/bus.hpp> - -#include <cstdint> - -namespace kapi::devices -{ - - //! A virtual CPU bus to host all CPUs in the system. - struct cpu final : kapi::devices::bus - { - //! A virtual CPU Core to host all core local devices. - struct core final : kapi::devices::bus - { - core(std::uint64_t index, std::uint64_t hardware_id, bool is_bsp); - - [[nodiscard]] auto hardware_id() const -> std::uint64_t; - [[nodiscard]] auto is_bsp() const -> bool; - [[nodiscard]] auto index() const noexcept -> std::uint64_t; - - private: - std::uint64_t m_index; - std::uint64_t m_hardware_id; - bool m_is_bsp; - }; - - //! Create a new CPU. - cpu(); - }; - -} // namespace kapi::devices - -#endif
\ No newline at end of file |
