aboutsummaryrefslogtreecommitdiff
path: root/kernel/kapi/devices
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-07-30 13:59:59 +0200
committerFelix Morgner <felix.morgner@ost.ch>2026-07-30 13:59:59 +0200
commit782b3c8563b2aacfe8f48a49fc6de7cbc26c4861 (patch)
tree50ed26cbad7c9796f02a21d19bce1946fe0cb1d7 /kernel/kapi/devices
parent2b542cb4d5f2302f41d478892694124472cde8b0 (diff)
downloadkernel-782b3c8563b2aacfe8f48a49fc6de7cbc26c4861.tar.xz
kernel-782b3c8563b2aacfe8f48a49fc6de7cbc26c4861.zip
kernel: implement dev zero and null
Diffstat (limited to 'kernel/kapi/devices')
-rw-r--r--kernel/kapi/devices/device_registry.cpp10
-rw-r--r--kernel/kapi/devices/error.cpp17
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{};