summaryrefslogtreecommitdiffhomepage
path: root/dev/Kernel/StorageKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2025-03-18 05:20:57 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2025-03-18 05:20:57 +0100
commit1311cdcfaa7fad132196a615899fd38393f54daf (patch)
tree27dbc62a874fb5ed39806475dbf7ed1828e0de40 /dev/Kernel/StorageKit
parent8740d53b6e4a5dae1b68123cba57782c3845f924 (diff)
feat(AHCI, HAL): Improve AHCI error handling & optimize HAL initialization
- Refactored `sk_acquire_ahci_device(Int32 drv_index)` to return `ErrorOr<AHCIDeviceInterface>` for proper error handling instead of returning a raw object. - Moved `sk_init_ahci_device(BOOL atapi)` into the `NeOS` namespace for better encapsulation. - Reduced `HbaMem::Ports` array size from `Ports[32]` to `Ports[1]` to optimize memory usage for single-port AHCI controllers. - Removed manual constructor initialization (`__CTOR_LIST__`, `__DTOR_LIST__`) from HAL, simplifying kernel startup. - Updated `hal_real_init()` to initialize AHCI storage (`sk_init_ahci_device(NO)`) before userland execution. - Refactored `hal_get_phys_address(void* virtual_address)` to use `VoidPtr` for type safety. - Fixed incorrect buffer size (`kSzIdent`) in AHCI driver initialization from `kib_cast(1)` to `512`, ensuring correct sector identification. - Removed redundant drive model string parsing logic. - Refactored AHCI PRD iteration loop to use `prd_i` instead of `i`, improving readability. - Optimized `drv_std_input_output` by simplifying wait loop logic. Overall, this commit improves AHCI error handling, reduces redundant initialization, optimizes memory usage, and cleans up HAL and storage code. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/Kernel/StorageKit')
-rw-r--r--dev/Kernel/StorageKit/AHCI.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/dev/Kernel/StorageKit/AHCI.h b/dev/Kernel/StorageKit/AHCI.h
index 12ca19d9..2eb0912b 100644
--- a/dev/Kernel/StorageKit/AHCI.h
+++ b/dev/Kernel/StorageKit/AHCI.h
@@ -54,6 +54,6 @@ namespace NeOS
UInt32 fDriveIndex{0U};
};
- UInt16 sk_init_ahci_device(BOOL atapi);
- AHCIDeviceInterface sk_acquire_ahci_device(Int32 drv_index);
+ UInt16 sk_init_ahci_device(BOOL atapi);
+ ErrorOr<AHCIDeviceInterface> sk_acquire_ahci_device(Int32 drv_index);
} // namespace NeOS