diff options
| author | Amlal <amlal@nekernel.org> | 2025-05-10 09:45:32 +0200 |
|---|---|---|
| committer | Amlal <amlal@nekernel.org> | 2025-05-10 09:45:32 +0200 |
| commit | b816e857b2d3b602473bf28703ad2cff722535e5 (patch) | |
| tree | f615cc7643c4b1f573f0e4972e04e59ecab88efd /dev/kernel/HALKit/AMD64 | |
| parent | 1391fa1bdc1cfe864596d3120bda12590131bc62 (diff) | |
dev(kernel): feat: AHCI driver improvements against 'disk hangs', and HeFS has been improved with better traversal, and inode/ind allocation.
Signed-off-by: Amlal <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel/HALKit/AMD64')
| -rw-r--r-- | dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc b/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc index ad4f9eeb..80053ea8 100644 --- a/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc +++ b/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc @@ -144,12 +144,6 @@ STATIC Void drv_std_input_output_ahci(UInt64 lba, UInt8* buffer, SizeT sector_sz lba /= sector_sz; - if (lba > kSATASectorCount) { - kout << "Out of range LBA.\r"; - err_global_get() = kErrorDisk; - return; - } - if (!buffer || size_buffer == 0) { kout << "Invalid buffer for AHCI I/O.\r"; err_global_get() = kErrorDisk; @@ -160,12 +154,12 @@ STATIC Void drv_std_input_output_ahci(UInt64 lba, UInt8* buffer, SizeT sector_sz UInt16 timeout = 0; - constexpr static UInt16 kTimeout = 0x7000; + constexpr static UInt16 kTimeout = 0x8000; while (slot == ~0UL) { - kout << "No free command slot found, AHCI disk is busy!\r"; - if (timeout > kTimeout) { + kout << "No free command slot found, AHCI disk is busy!\r"; + err_global_get() = kErrorDisk; return; } @@ -265,7 +259,18 @@ STATIC Void drv_std_input_output_ahci(UInt64 lba, UInt8* buffer, SizeT sector_sz // Issue command kSATAHba->Ports[kSATAIndex].Ci = (1 << slot); + timeout = 0UL; + while (YES) { + if (timeout > kTimeout) { + kout << "Disk hangup!\r"; + + err_global_get() = kErrorDisk; + return; + } + + ++timeout; + if (!(kSATAHba->Ports[kSATAIndex].Ci & (1 << slot))) break; } |
