diff options
Diffstat (limited to 'kernel/kapi')
| -rw-r--r-- | kernel/kapi/devices/device_registry.cpp | 10 | ||||
| -rw-r--r-- | kernel/kapi/devices/error.cpp | 17 |
2 files changed, 22 insertions, 5 deletions
diff --git a/kernel/kapi/devices/device_registry.cpp b/kernel/kapi/devices/device_registry.cpp index 80ddde65..080ae39b 100644 --- a/kernel/kapi/devices/device_registry.cpp +++ b/kernel/kapi/devices/device_registry.cpp @@ -1,5 +1,6 @@ #include <kapi/devices/device_registry.hpp> +#include <kapi/devices/bus.hpp> #include <kapi/devices/device.hpp> #include <kapi/system.hpp> @@ -48,7 +49,14 @@ namespace kapi::devices return false; } - kstd::println("[OS:DEV] Registering device {}", device->name()); + if (device->facet<bus>()) + { + kstd::println("[OS:DEV] Registering bus {}", device->name()); + } + else + { + kstd::println("[OS:DEV] Registering device {}", device->name()); + } auto added = false; { diff --git a/kernel/kapi/devices/error.cpp b/kernel/kapi/devices/error.cpp index 9d814fbe..40320551 100644 --- a/kernel/kapi/devices/error.cpp +++ b/kernel/kapi/devices/error.cpp @@ -3,7 +3,6 @@ #include <kstd/system_error.hpp> #include <string_view> -#include <utility> namespace kapi::devices { @@ -23,6 +22,10 @@ namespace kapi::devices { case driver_match_errc::no_match: return "driver does not match this device"; + case driver_match_errc::no_device_signature: + return "missing device signature"; + case driver_match_errc::invalid_device_signature: + return "device signature is invalid"; default: return "unknown driver matching error"; } @@ -30,11 +33,17 @@ namespace kapi::devices [[nodiscard]] auto default_error_condition(int value) const noexcept -> kstd::error_condition override { - if (value == std::to_underlying(driver_match_errc::no_match)) + switch (static_cast<driver_match_errc>(value)) { - return make_error_condition(kstd::errc::not_supported); + case driver_match_errc::no_match: + case driver_match_errc::no_device_signature: + return make_error_condition(kstd::errc::not_supported); + break; + case driver_match_errc::invalid_device_signature: + return make_error_condition(kstd::errc::invalid_argument); + default: + return kstd::error_category::default_error_condition(value); } - return kstd::error_category::default_error_condition(value); } } constexpr driver_match_category_instance{}; |
