diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-07-21 17:27:05 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-07-21 17:27:05 +0200 |
| commit | 4539791823a2fb1506e9091ec5087c80a87adfde (patch) | |
| tree | c681ccdbb1664a5810b246bef08da20a34e61b30 /arch/x86_64 | |
| parent | b312d810400f9be112f13df670d92aebfddc10a9 (diff) | |
| download | kernel-4539791823a2fb1506e9091ec5087c80a87adfde.tar.xz kernel-4539791823a2fb1506e9091ec5087c80a87adfde.zip | |
kapi/device: remove major and minor
Diffstat (limited to 'arch/x86_64')
| -rw-r--r-- | arch/x86_64/arch/bus/isa.cpp | 6 | ||||
| -rw-r--r-- | arch/x86_64/arch/bus/isa.hpp | 4 | ||||
| -rw-r--r-- | arch/x86_64/arch/devices/init.cpp | 6 | ||||
| -rw-r--r-- | arch/x86_64/arch/devices/legacy_pit.cpp | 5 | ||||
| -rw-r--r-- | arch/x86_64/arch/devices/legacy_pit.hpp | 3 | ||||
| -rw-r--r-- | arch/x86_64/arch/devices/local_apic.cpp | 7 | ||||
| -rw-r--r-- | arch/x86_64/arch/devices/local_apic.hpp | 3 | ||||
| -rw-r--r-- | arch/x86_64/kapi/cpu.cpp | 12 |
8 files changed, 16 insertions, 30 deletions
diff --git a/arch/x86_64/arch/bus/isa.cpp b/arch/x86_64/arch/bus/isa.cpp index f6cc72dc..dd248f76 100644 --- a/arch/x86_64/arch/bus/isa.cpp +++ b/arch/x86_64/arch/bus/isa.cpp @@ -2,13 +2,11 @@ #include <kapi/devices.hpp> -#include <cstddef> - namespace arch::bus { - isa::isa(std::size_t major) - : kapi::devices::bus{major, 0, "isa"} + isa::isa() + : kapi::devices::bus{"isa"} {} } // namespace arch::bus
\ No newline at end of file diff --git a/arch/x86_64/arch/bus/isa.hpp b/arch/x86_64/arch/bus/isa.hpp index e56f56a2..5741a640 100644 --- a/arch/x86_64/arch/bus/isa.hpp +++ b/arch/x86_64/arch/bus/isa.hpp @@ -3,14 +3,12 @@ #include <kapi/devices/bus.hpp> -#include <cstddef> - namespace arch::bus { struct isa final : public kapi::devices::bus { - isa(std::size_t major); + isa(); }; } // namespace arch::bus diff --git a/arch/x86_64/arch/devices/init.cpp b/arch/x86_64/arch/devices/init.cpp index 134d6dac..4ac287cf 100644 --- a/arch/x86_64/arch/devices/init.cpp +++ b/arch/x86_64/arch/devices/init.cpp @@ -62,11 +62,9 @@ namespace arch::devices { kstd::println("[x86_64:DEV] Initializing ISA bus..."); - auto isa_major_number = kapi::devices::allocate_major_number(); - auto isa_bus = kstd::make_unique<arch::bus::isa>(isa_major_number); + auto isa_bus = kstd::make_unique<arch::bus::isa>(); - auto pit_major_number = kapi::devices::allocate_major_number(); - auto pit = kstd::make_unique<arch::devices::legacy_pit>(pit_major_number, pit_frequency_in_hz); + auto pit = kstd::make_unique<arch::devices::legacy_pit>(pit_frequency_in_hz); isa_bus->add_child(std::move(pit)); auto & root_bus = kapi::devices::get_root_bus(); diff --git a/arch/x86_64/arch/devices/legacy_pit.cpp b/arch/x86_64/arch/devices/legacy_pit.cpp index d542d475..d93b38fd 100644 --- a/arch/x86_64/arch/devices/legacy_pit.cpp +++ b/arch/x86_64/arch/devices/legacy_pit.cpp @@ -6,7 +6,6 @@ #include <kapi/devices/device.hpp> #include <kapi/interrupts.hpp> -#include <cstddef> #include <cstdint> namespace arch::devices @@ -23,8 +22,8 @@ namespace arch::devices constexpr auto square_wave_mode = 0x36; } // namespace - legacy_pit::legacy_pit(std::size_t major, std::uint32_t frequency_in_hz) - : kapi::devices::device{major, 0, "legacy_pit"} + legacy_pit::legacy_pit(std::uint32_t frequency_in_hz) + : kapi::devices::device{"legacy_pit"} , m_irq_number{0} , m_frequency_in_hz{frequency_in_hz} {} diff --git a/arch/x86_64/arch/devices/legacy_pit.hpp b/arch/x86_64/arch/devices/legacy_pit.hpp index 356895c7..7a74144e 100644 --- a/arch/x86_64/arch/devices/legacy_pit.hpp +++ b/arch/x86_64/arch/devices/legacy_pit.hpp @@ -4,7 +4,6 @@ #include <kapi/devices/device.hpp> #include <kapi/interrupts.hpp> -#include <cstddef> #include <cstdint> namespace arch::devices @@ -12,7 +11,7 @@ namespace arch::devices struct legacy_pit : kapi::devices::device, kapi::interrupts::handler { - legacy_pit(std::size_t major, std::uint32_t frequency_in_hz); + explicit legacy_pit(std::uint32_t frequency_in_hz); auto init() -> bool override; diff --git a/arch/x86_64/arch/devices/local_apic.cpp b/arch/x86_64/arch/devices/local_apic.cpp index f3ab8d32..e7108f8f 100644 --- a/arch/x86_64/arch/devices/local_apic.cpp +++ b/arch/x86_64/arch/devices/local_apic.cpp @@ -3,6 +3,7 @@ #include <kapi/devices.hpp> #include <kapi/memory.hpp> +#include <kstd/format.hpp> #include <kstd/print.hpp> #include <cstddef> @@ -74,9 +75,9 @@ namespace arch::devices divide_configuration = 0x3e0, }; - local_apic::local_apic(std::size_t major, std::size_t minor, std::uint64_t core_index, std::uint64_t hardware_id, - kapi::memory::physical_address base, bool is_bsp) - : kapi::devices::device{major, minor, "lapic"} + local_apic::local_apic(std::uint64_t core_index, std::uint64_t hardware_id, kapi::memory::physical_address base, + bool is_bsp) + : kapi::devices::device{kstd::format("lapic{}", core_index)} , m_core_index{core_index} , m_hardware_id{hardware_id} , m_base{base} diff --git a/arch/x86_64/arch/devices/local_apic.hpp b/arch/x86_64/arch/devices/local_apic.hpp index 3a2d5417..4b82050b 100644 --- a/arch/x86_64/arch/devices/local_apic.hpp +++ b/arch/x86_64/arch/devices/local_apic.hpp @@ -12,8 +12,7 @@ namespace arch::devices struct local_apic : kapi::devices::device { - local_apic(std::size_t major, std::size_t minor, std::uint64_t core_index, std::uint64_t hardware_id, - kapi::memory::physical_address base, bool is_bsp); + local_apic(std::uint64_t core_index, std::uint64_t hardware_id, kapi::memory::physical_address base, bool is_bsp); auto init() -> bool override; diff --git a/arch/x86_64/kapi/cpu.cpp b/arch/x86_64/kapi/cpu.cpp index 787a230e..bd86f0fa 100644 --- a/arch/x86_64/kapi/cpu.cpp +++ b/arch/x86_64/kapi/cpu.cpp @@ -48,10 +48,6 @@ namespace kapi::cpu auto discover_topology() -> bool { - auto static const cpu_major = kapi::devices::allocate_major_number(); - auto static const core_major = kapi::devices::allocate_major_number(); - auto static const interrupt_controller_major = kapi::devices::allocate_major_number(); - auto madt = kapi::acpi::get_table<::acpi::table_signature_v<::acpi::madt>>(); if (!madt) { @@ -68,16 +64,14 @@ namespace kapi::cpu auto bsp_found = false; auto core_index = 0uz; auto local_apic_address = memory::physical_address{madt->local_interrupt_controller_address()}; - auto cpu_bus = kstd::make_unique<devices::cpu>(cpu_major, 0); + auto cpu_bus = kstd::make_unique<devices::cpu>(); for (auto const & apic : lapic_entries) { auto is_bsp = !bsp_found; bsp_found = true; - auto core = - kstd::make_unique<devices::cpu::core>(core_major, core_index, core_index, apic.processor_id(), is_bsp); - core->add_child(kstd::make_unique<arch::devices::local_apic>(interrupt_controller_major, core_index, core_index, - apic.id(), local_apic_address, is_bsp)); + auto core = kstd::make_unique<devices::cpu::core>(core_index, apic.processor_id(), is_bsp); + core->add_child(kstd::make_unique<arch::devices::local_apic>(core_index, apic.id(), local_apic_address, is_bsp)); cpu_bus->add_child(std::move(core)); ++core_index; } |
