#include #include #include #include #include #include #include #include #include namespace kapi::devices { bus::bus(kstd::string const & name) : device{name} {} auto bus::add_child(kstd::shared_ptr child) -> void { child->set_parent(kstd::static_pointer_cast(shared_from_this())); if (!kapi::devices::device_registry::get().add(child)) { kapi::system::panic("[OS:DEV] Failed to register child device {}", child->name()); } auto & attached = m_devices.emplace_back(std::move(child)); attached->set_state(state::present); driver_registry::get().device_attached(attached); } [[nodiscard]] auto bus::children() const -> std::span const> { return {m_devices.data(), m_devices.size()}; } auto bus::protocol() -> struct bus_protocol * { return nullptr; } auto bus::query_interface(interface_id interface) -> void * { if (interface == bus::id) { return this; } return device::query_interface(interface); } } // namespace kapi::devices