diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-04-29 09:36:43 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-04-29 09:36:43 +0200 |
| commit | d6ef2153fb32ee7ba04acdf37e7a535a855229db (patch) | |
| tree | d2cd3275797208b1f78c44baa63739fa8645146f /arch/x86_64/src/devices/init.cpp | |
| parent | d906d70c94c2a40d5fc6fd26056c7bc57d540002 (diff) | |
| parent | c3d5a155025b445ab9213f131681afe9410b4e66 (diff) | |
| download | teachos-d6ef2153fb32ee7ba04acdf37e7a535a855229db.tar.xz teachos-d6ef2153fb32ee7ba04acdf37e7a535a855229db.zip | |
Merge branch 'fmorgner/develop-BA-FS26/x86-64-use-p1204-layout' into 'develop-BA-FS26'
chore: migrate 'arch' to p1204 project layout
See merge request teachos/kernel!28
Diffstat (limited to 'arch/x86_64/src/devices/init.cpp')
| -rw-r--r-- | arch/x86_64/src/devices/init.cpp | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/arch/x86_64/src/devices/init.cpp b/arch/x86_64/src/devices/init.cpp deleted file mode 100644 index c30e8cf..0000000 --- a/arch/x86_64/src/devices/init.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include <arch/devices/init.hpp> - -#include <arch/boot/boot.hpp> -#include <arch/bus/isa.hpp> -#include <arch/devices/legacy_pit.hpp> - -#include <kapi/acpi.hpp> -#include <kapi/cpu.hpp> -#include <kapi/devices.hpp> - -#include <acpi/acpi.hpp> - -#include <kstd/memory> -#include <kstd/print> - -#include <cstdint> -#include <utility> - -namespace arch::devices -{ - - namespace - { - constexpr auto pit_frequency_in_hz = std::uint32_t{100u}; - - auto get_acpi_root_pointer() -> kstd::observer_ptr<::acpi::rsdp const> - { - auto const & mbi = kapi::boot::bootstrap_information.mbi; - auto system_description_pointer = static_cast<::acpi::rsdp const *>(nullptr); - - if (auto const & xsdp = mbi->maybe_acpi_xsdp()) - { - auto data = xsdp->pointer().data(); - - system_description_pointer = reinterpret_cast<::acpi::xsdp const *>(data); - } - else if (auto const & rsdp = mbi->maybe_acpi_rsdp()) - { - auto data = rsdp->pointer().data(); - system_description_pointer = reinterpret_cast<::acpi::rsdp const *>(data); - } - - return kstd::make_observer(system_description_pointer); - } - } // namespace - - auto init_acpi_devices() -> void - { - auto acpi_root_pointer = get_acpi_root_pointer(); - if (acpi_root_pointer && acpi_root_pointer->validate()) - { - if (kapi::acpi::init(*acpi_root_pointer)) - { - kstd::println("[x86_64:DEV] ACPI subsystem initialized."); - } - } - - kapi::cpu::discover_topology(); - } - - auto init_legacy_devices() -> void - { - 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 pit_major_number = kapi::devices::allocate_major_number(); - auto pit = kstd::make_unique<arch::devices::legacy_pit>(pit_major_number, pit_frequency_in_hz); - isa_bus->add_child(std::move(pit)); - - auto & root_bus = kapi::devices::get_root_bus(); - root_bus.add_child(std::move(isa_bus)); - } - -} // namespace arch::devices |
