aboutsummaryrefslogtreecommitdiff
path: root/kernel/devices/src
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/devices/src')
-rw-r--r--kernel/devices/src/storage/StorageManagement.cpp39
1 files changed, 38 insertions, 1 deletions
diff --git a/kernel/devices/src/storage/StorageManagement.cpp b/kernel/devices/src/storage/StorageManagement.cpp
index f34fa15..14c59ac 100644
--- a/kernel/devices/src/storage/StorageManagement.cpp
+++ b/kernel/devices/src/storage/StorageManagement.cpp
@@ -1,9 +1,46 @@
#include "devices/storage/StorageManagement.hpp"
+#include "kapi/system.hpp"
+
+#include "devices/BlockDevice.hpp"
+#include "devices/storage/StorageController.hpp"
+
+#include <optional>
+
namespace devices::storage
{
+ namespace
+ {
+ constinit auto static active_storage_management = std::optional<storage_management>{};
+ } // namespace
+
auto storage_management::init() -> void
{
- // TODO BA-FS26 implement storage management initialization
+ if (active_storage_management)
+ {
+ kapi::system::panic("[DEVICES] Storage management has already been initialized.");
+ }
+ active_storage_management.emplace(storage_management{});
+ }
+
+ auto storage_management::get() -> storage_management &
+ {
+ if (!active_storage_management)
+ {
+ kapi::system::panic("[DEVICES] Storage management has not been initialized.");
+ }
+
+ return *active_storage_management;
+ }
+
+ auto storage_management::add_controller(storage_controller * controller) -> void
+ {
+ m_controllers.at(0) = controller; // TODO BA-FS26 use push_back from kstd:vector
}
+
+ auto storage_management::add_device(block_device * device) -> void
+ {
+ m_devices.at(0) = device; // TODO BA-FS26 use push_back from kstd:vector
+ }
+
} // namespace devices::storage \ No newline at end of file