aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/x86_64/CMakeLists.txt1
-rw-r--r--arch/x86_64/kapi/acpi.cpp32
-rw-r--r--arch/x86_64/src/devices/init.cpp41
3 files changed, 39 insertions, 35 deletions
diff --git a/arch/x86_64/CMakeLists.txt b/arch/x86_64/CMakeLists.txt
index 62a2aad..f182651 100644
--- a/arch/x86_64/CMakeLists.txt
+++ b/arch/x86_64/CMakeLists.txt
@@ -12,7 +12,6 @@ target_link_libraries("x86_64" PUBLIC
target_sources("x86_64" PRIVATE
# Platform-dependent KAPI implementation
- "kapi/acpi.cpp"
"kapi/boot_modules.cpp"
"kapi/cio.cpp"
"kapi/cpu.cpp"
diff --git a/arch/x86_64/kapi/acpi.cpp b/arch/x86_64/kapi/acpi.cpp
deleted file mode 100644
index 40b7160..0000000
--- a/arch/x86_64/kapi/acpi.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-#include "kapi/acpi.hpp"
-
-#include "arch/boot/boot.hpp"
-
-#include <kstd/memory>
-
-#include <acpi/acpi.hpp>
-
-namespace kapi::acpi
-{
-
- auto get_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 kapi::acpi \ No newline at end of file
diff --git a/arch/x86_64/src/devices/init.cpp b/arch/x86_64/src/devices/init.cpp
index 6cba986..7f0faa4 100644
--- a/arch/x86_64/src/devices/init.cpp
+++ b/arch/x86_64/src/devices/init.cpp
@@ -1,13 +1,18 @@
#include "arch/devices/init.hpp"
+#include "kapi/acpi.hpp"
+#include "kapi/cpu.hpp"
#include "kapi/devices.hpp"
+#include "arch/boot/boot.hpp"
#include "arch/bus/isa.hpp"
#include "arch/devices/legacy_pit.hpp"
#include <kstd/memory>
#include <kstd/print>
+#include <acpi/acpi.hpp>
+
#include <cstdint>
#include <utility>
@@ -17,9 +22,41 @@ namespace arch::devices
namespace
{
constexpr auto pit_frequency_in_hz = std::uint32_t{100u};
- }
- auto init_acpi_devices() -> void {}
+ 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
{