diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-07-23 22:34:49 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-07-23 22:34:49 +0200 |
| commit | 7d78433e6ea80b651f80201b6c5beef799887e7f (patch) | |
| tree | 09135131ee0833f99ce9b5126ea9fe4d31be1ceb /kapi | |
| parent | 4a58a7c7cb1f37e0183de9b838def3a217504e7b (diff) | |
| download | kernel-7d78433e6ea80b651f80201b6c5beef799887e7f.tar.xz kernel-7d78433e6ea80b651f80201b6c5beef799887e7f.zip | |
x86_64: port legacy PIT driver to new architecture
Diffstat (limited to 'kapi')
| -rw-r--r-- | kapi/kapi/devices/bus.hpp | 2 | ||||
| -rw-r--r-- | kapi/kapi/devices/driver.hpp | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/kapi/kapi/devices/bus.hpp b/kapi/kapi/devices/bus.hpp index 0e654072..10b9c39d 100644 --- a/kapi/kapi/devices/bus.hpp +++ b/kapi/kapi/devices/bus.hpp @@ -50,7 +50,7 @@ namespace kapi::devices //! Enumerate the devices on the bus. //! //! @return true iff. the bus hardware is healthy, false otherwise. - auto virtual enumerate() -> bool; + auto virtual enumerate_old() -> bool; private: kstd::vector<kstd::shared_ptr<device>> m_devices; diff --git a/kapi/kapi/devices/driver.hpp b/kapi/kapi/devices/driver.hpp index fde5068c..254f7977 100644 --- a/kapi/kapi/devices/driver.hpp +++ b/kapi/kapi/devices/driver.hpp @@ -54,6 +54,16 @@ namespace kapi::devices return static_cast<InterfaceType *>(query_interface(InterfaceType::id)); } + //! Retrieve this drivers implementation of a given capability interface. + //! + //! @return A pointer to this drivers implementation of the requested interface, nullptr if this driver does not + //! support the requested interface. + template<typename InterfaceType> + [[nodiscard]] auto as() const -> InterfaceType const * + { + return static_cast<InterfaceType *>(const_cast<driver *>(this)->query_interface(InterfaceType::id)); + } + //! Check if this driver implements a given capability interface. //! //! @return true iff. this driver implements the requested capability interface, false otherwise. |
