aboutsummaryrefslogtreecommitdiff
path: root/kapi
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-07-23 23:55:28 +0200
committerFelix Morgner <felix.morgner@ost.ch>2026-07-23 23:55:28 +0200
commitb334a8494bef50c5b90adc1f101464fc8c4c971a (patch)
tree591efae83a93d25e45ab3b32d5d3d2e6c94d702b /kapi
parent7d78433e6ea80b651f80201b6c5beef799887e7f (diff)
downloadkernel-b334a8494bef50c5b90adc1f101464fc8c4c971a.tar.xz
kernel-b334a8494bef50c5b90adc1f101464fc8c4c971a.zip
kernel: port ram disk to new driver architecture
Diffstat (limited to 'kapi')
-rw-r--r--kapi/kapi/boot_module/bus.hpp71
1 files changed, 71 insertions, 0 deletions
diff --git a/kapi/kapi/boot_module/bus.hpp b/kapi/kapi/boot_module/bus.hpp
new file mode 100644
index 00000000..e569b253
--- /dev/null
+++ b/kapi/kapi/boot_module/bus.hpp
@@ -0,0 +1,71 @@
+#ifndef TEACHOS_KAPI_BOOT_MODULE_BUS_HPP
+#define TEACHOS_KAPI_BOOT_MODULE_BUS_HPP
+
+#include <kapi/boot_module/boot_module.hpp>
+#include <kapi/boot_module/boot_module_registry.hpp>
+#include <kapi/devices.hpp>
+
+#include <kstd/result.hpp>
+
+#include <cstddef>
+#include <string_view>
+#include <utility>
+
+namespace kapi::boot_modules
+{
+
+ struct boot_module_identification
+ {
+ constexpr auto static id = devices::interface{"boot_module_identification"};
+
+ virtual ~boot_module_identification() = default;
+
+ [[nodiscard]] auto virtual command_line() const -> std::string_view = 0;
+
+ [[nodiscard]] auto virtual module() const -> boot_module const & = 0;
+ };
+
+ struct boot_module_driver_identification
+ {
+ constexpr auto static id = devices::interface{"boot_module_driver_identification"};
+
+ virtual ~boot_module_driver_identification() = default;
+
+ [[nodiscard]] virtual auto claimed_parameter() const -> std::pair<std::string_view, std::string_view> = 0;
+ };
+
+ struct boot_module_device final : kapi::devices::device, boot_module_identification
+ {
+ boot_module_device(std::size_t index, boot_module const & module);
+
+ auto init() -> bool override;
+
+ auto command_line() const -> std::string_view override;
+
+ auto module() const -> boot_module const & override;
+
+ protected:
+ auto query_interface(kapi::devices::interface interface) -> void * override;
+
+ private:
+ boot_module m_module;
+ };
+
+ struct boot_module_bus final : kapi::devices::bus, kapi::devices::bus_protocol
+ {
+ explicit boot_module_bus(boot_module_registry const * registry);
+
+ auto enumerate(kapi::devices::bus & self) -> void override;
+
+ [[nodiscard]] auto match(kapi::devices::device const & dev, kapi::devices::driver const & drv) const
+ -> kstd::result<unsigned> override;
+
+ [[nodiscard]] auto protocol() -> kapi::devices::bus_protocol * override;
+
+ private:
+ boot_module_registry const * m_registry;
+ };
+
+} // namespace kapi::boot_modules
+
+#endif \ No newline at end of file