From abb9aca8e7e86e28875b211a47f1a59dd02098b6 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Tue, 11 Mar 2025 12:25:04 +0100 Subject: ADD: A better AHCI driver. --- dev/Kernel/HALKit/AMD64/Storage/AHCI.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'dev/Kernel') diff --git a/dev/Kernel/HALKit/AMD64/Storage/AHCI.cc b/dev/Kernel/HALKit/AMD64/Storage/AHCI.cc index f2e0fda5..f36b8e28 100644 --- a/dev/Kernel/HALKit/AMD64/Storage/AHCI.cc +++ b/dev/Kernel/HALKit/AMD64/Storage/AHCI.cc @@ -20,6 +20,8 @@ #include #include +#include + #include #include #include @@ -138,9 +140,9 @@ STATIC Void drv_std_input_output(UInt64 lba, UInt8* buffer, SizeT sector_sz, Siz for (; i < (command_header->Prdtl - 1); i++) { - command_table->Prdt[i].Dba = ((UInt32)(UInt64)buffer_phys); - command_table->Prdt[i].Dbau = (((UInt64)(buffer_phys) >> 32)); command_table->Prdt[i].Dbc = ((size_buffer / command_header->Prdtl - 1) - 1); + command_table->Prdt[i].Dba = ((UInt32)(UInt64)buffer_phys + (i * command_table->Prdt[i].Dbc)); + command_table->Prdt[i].Dbau = (((UInt64)(buffer_phys) >> 32) + (i * command_table->Prdt[i].Dbc)); command_table->Prdt[i].Ie = YES; } -- cgit v1.2.3