summaryrefslogtreecommitdiffhomepage
path: root/dev/Kernel/HALKit/AMD64/Storage/SATA.cc
diff options
context:
space:
mode:
Diffstat (limited to 'dev/Kernel/HALKit/AMD64/Storage/SATA.cc')
-rw-r--r--dev/Kernel/HALKit/AMD64/Storage/SATA.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/dev/Kernel/HALKit/AMD64/Storage/SATA.cc b/dev/Kernel/HALKit/AMD64/Storage/SATA.cc
index 26391340..00ef8767 100644
--- a/dev/Kernel/HALKit/AMD64/Storage/SATA.cc
+++ b/dev/Kernel/HALKit/AMD64/Storage/SATA.cc
@@ -184,8 +184,13 @@ static Kernel::Void drv_std_input_output(Kernel::UInt64 lba, Kernel::UInt8* buff
if (slot == -1)
return;
+ if (size_buffer > mib_cast(4))
+ Kernel::ke_panic(RUNTIME_CHECK_FAILED, "AHCI only supports < 4mb DMA transfers.");
+
HbaCmdHeader* command_header = ((HbaCmdHeader*)((Kernel::UInt64)kSATAPort->Ports[kSATAPortIdx].Clb + kSATAPort->Ports[kSATAPortIdx].Clbu));
+ command_header += slot;
+
Kernel::rt_set_memory(reinterpret_cast<Kernel::VoidPtr>(command_header), 0, sizeof(HbaCmdHeader));
MUST_PASS(command_header);
@@ -200,10 +205,10 @@ static Kernel::Void drv_std_input_output(Kernel::UInt64 lba, Kernel::UInt8* buff
MUST_PASS(command_table);
- command_table->Prdt[0].Dba = ((Kernel::UInt32)(Kernel::UInt64)Kernel::HAL::hal_get_phys_address(buffer));
- command_table->Prdt[0].Dbau = (((Kernel::UInt64)Kernel::HAL::hal_get_phys_address(buffer) >> 32));
- command_table->Prdt[0].Dbc = ((size_buffer)-1);
- command_table->Prdt[0].InterruptBit = 1;
+ command_table->Prdt[0].Dba = ((Kernel::UInt32)(Kernel::UInt64)Kernel::HAL::hal_get_phys_address(buffer));
+ command_table->Prdt[0].Dbau = (((Kernel::UInt64)Kernel::HAL::hal_get_phys_address(buffer) >> 32));
+ command_table->Prdt[0].Dbc = ((size_buffer)-1);
+ command_table->Prdt[0].IE = 1;
command_header->Ctba = ((Kernel::UInt32)(Kernel::UInt64)command_table);
command_header->Ctbau = ((Kernel::UInt32)((Kernel::UInt64)command_table >> 32));