aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-07-24 21:30:33 +0200
committerFelix Morgner <felix.morgner@ost.ch>2026-07-24 21:30:33 +0200
commita1f1ddabf24fb6dfb1bcfc6257c44b6a2bfba8ab (patch)
tree8bd127817b0b77dfd4f809a775ebb05893bc3bad /arch/x86_64
parent1eec1ed62987f34a8473db0ff2b89f82dd92ff4d (diff)
downloadkernel-a1f1ddabf24fb6dfb1bcfc6257c44b6a2bfba8ab.tar.xz
kernel-a1f1ddabf24fb6dfb1bcfc6257c44b6a2bfba8ab.zip
x86_64: clean up isa drivers
Diffstat (limited to 'arch/x86_64')
-rw-r--r--arch/x86_64/arch/bus/isa.cpp13
-rw-r--r--arch/x86_64/arch/bus/isa.hpp22
-rw-r--r--arch/x86_64/arch/devices/pit.cpp4
-rw-r--r--arch/x86_64/arch/devices/pit.hpp2
-rw-r--r--arch/x86_64/arch/drivers/pit.cpp4
-rw-r--r--arch/x86_64/arch/drivers/pit.hpp2
6 files changed, 29 insertions, 18 deletions
diff --git a/arch/x86_64/arch/bus/isa.cpp b/arch/x86_64/arch/bus/isa.cpp
index 573feb72..f0ed02f4 100644
--- a/arch/x86_64/arch/bus/isa.cpp
+++ b/arch/x86_64/arch/bus/isa.cpp
@@ -22,10 +22,15 @@ namespace arch::bus
auto isa::match(kapi::devices::device const & device, kapi::devices::driver const & driver) const
-> kstd::result<std::uint32_t>
{
- auto identification = device.as<isa_identification>();
- auto claims = driver.as<isa_driver_identification>();
+ auto device_signature = device.as<isa_signature>();
+ auto driver_claim = driver.as<isa_claim>();
- if (!identification || !claims || !std::ranges::contains(claims->supported_names(), identification->isa_name()))
+ if (!device_signature || !driver_claim)
+ {
+ return kstd::failure(kapi::devices::driver_match_errc::no_match);
+ }
+
+ if (!std::ranges::contains(driver_claim->supported_names(), device_signature->isa_name()))
{
return kstd::failure(kapi::devices::driver_match_errc::no_match);
}
@@ -33,7 +38,7 @@ namespace arch::bus
return 0u;
}
- auto isa::protocol() -> kapi::devices::bus_protocol *
+ auto isa::protocol() -> isa *
{
return this;
}
diff --git a/arch/x86_64/arch/bus/isa.hpp b/arch/x86_64/arch/bus/isa.hpp
index fa85c8e8..58bc042f 100644
--- a/arch/x86_64/arch/bus/isa.hpp
+++ b/arch/x86_64/arch/bus/isa.hpp
@@ -12,30 +12,36 @@
namespace arch::bus
{
- //! The identification interface used to identify ISA devices.
- struct isa_identification
+ //! The signature interface used to identify ISA devices.
+ struct isa_signature
{
//! The ID of this interface.
- constexpr auto static id = kapi::devices::interface_id{"isa_identification"};
+ constexpr auto static id = kapi::devices::interface_id{"isa_signature"};
//! Allow for correct destruction through base pointers.
- virtual ~isa_identification() = default;
+ virtual ~isa_signature() = default;
//! Return the ISA name of the device.
[[nodiscard]] virtual auto isa_name() const -> std::string_view = 0;
};
- struct isa_driver_identification
+ //! The claim interface used to match ISA drivers.
+ struct isa_claim
{
- constexpr auto static id = kapi::devices::interface_id{"isa_driver_identification"};
+ //! The ID of this interface
+ constexpr auto static id = kapi::devices::interface_id{"isa_claim"};
- virtual ~isa_driver_identification() = default;
+ //! Allow for correct destruction through base pointers.
+ virtual ~isa_claim() = default;
+ //! The list of ISA names supported by a given driver.
[[nodiscard]] virtual auto supported_names() const -> std::span<std::string_view const> = 0;
};
+ //! The ISA bus.
struct isa final : public kapi::devices::bus, kapi::devices::bus_protocol
{
+ //! Construct a default ISA bus.
isa();
auto enumerate(kapi::devices::bus & self) -> void override;
@@ -43,7 +49,7 @@ namespace arch::bus
[[nodiscard]] auto match(kapi::devices::device const & device, kapi::devices::driver const & driver) const
-> kstd::result<std::uint32_t> override;
- [[nodiscard]] auto protocol() -> kapi::devices::bus_protocol * override;
+ [[nodiscard]] auto protocol() -> isa * override;
};
} // namespace arch::bus
diff --git a/arch/x86_64/arch/devices/pit.cpp b/arch/x86_64/arch/devices/pit.cpp
index a280bcdc..6a8e9974 100644
--- a/arch/x86_64/arch/devices/pit.cpp
+++ b/arch/x86_64/arch/devices/pit.cpp
@@ -20,9 +20,9 @@ namespace arch::devices
auto pit::query_interface(kapi::devices::interface_id interface) -> void *
{
- if (interface == arch::bus::isa_identification::id)
+ if (interface == arch::bus::isa_signature::id)
{
- return static_cast<arch::bus::isa_identification *>(this);
+ return static_cast<arch::bus::isa_signature *>(this);
}
return kapi::devices::device::query_interface(interface);
diff --git a/arch/x86_64/arch/devices/pit.hpp b/arch/x86_64/arch/devices/pit.hpp
index 452eedc0..adb722ab 100644
--- a/arch/x86_64/arch/devices/pit.hpp
+++ b/arch/x86_64/arch/devices/pit.hpp
@@ -13,7 +13,7 @@ namespace arch::devices
//! The ISA device for the legacy Programmable Interrupt Timer.
//!
//! This type identifies the PIT device node to the driver, so the driver can be matched successfully.
- struct pit final : kapi::devices::device, arch::bus::isa_identification
+ struct pit final : kapi::devices::device, arch::bus::isa_signature
{
//! Construct a new PIT device.
pit();
diff --git a/arch/x86_64/arch/drivers/pit.cpp b/arch/x86_64/arch/drivers/pit.cpp
index 6bad179e..4ca2fef8 100644
--- a/arch/x86_64/arch/drivers/pit.cpp
+++ b/arch/x86_64/arch/drivers/pit.cpp
@@ -89,9 +89,9 @@ namespace arch::drivers
auto pit::query_interface(kapi::devices::interface_id interface) -> void *
{
- if (interface == arch::bus::isa_driver_identification::id)
+ if (interface == arch::bus::isa_claim::id)
{
- return static_cast<arch::bus::isa_driver_identification *>(this);
+ return static_cast<arch::bus::isa_claim *>(this);
}
return kapi::devices::driver::query_interface(interface);
diff --git a/arch/x86_64/arch/drivers/pit.hpp b/arch/x86_64/arch/drivers/pit.hpp
index 6e51ec36..0f5740b3 100644
--- a/arch/x86_64/arch/drivers/pit.hpp
+++ b/arch/x86_64/arch/drivers/pit.hpp
@@ -17,7 +17,7 @@ namespace arch::drivers
{
//! The driver for the legacy, ISA-connected Programmable Interrupt Timer.
- struct pit final : kapi::devices::driver, arch::bus::isa_driver_identification, kapi::interrupts::handler
+ struct pit final : kapi::devices::driver, arch::bus::isa_claim, kapi::interrupts::handler
{
explicit pit(std::uint32_t frequency_in_hz);