From 3e4d410646865a0e1266e09ab5b1a8247c10f95b Mon Sep 17 00:00:00 2001 From: Bananymous Date: Fri, 22 Mar 2024 13:34:57 +0200 Subject: [PATCH] Kernel: Fix AHCI device physical address writing on i386 target --- kernel/kernel/Storage/ATA/AHCI/Device.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kernel/kernel/Storage/ATA/AHCI/Device.cpp b/kernel/kernel/Storage/ATA/AHCI/Device.cpp index 52f6b706f0..c671f6337d 100644 --- a/kernel/kernel/Storage/ATA/AHCI/Device.cpp +++ b/kernel/kernel/Storage/ATA/AHCI/Device.cpp @@ -70,11 +70,11 @@ namespace Kernel stop_cmd(m_port); - paddr_t fis_paddr = m_dma_region->paddr(); + uint64_t fis_paddr = m_dma_region->paddr(); m_port->fb = fis_paddr & 0xFFFFFFFF; m_port->fbu = fis_paddr >> 32; - paddr_t command_list_paddr = fis_paddr + sizeof(ReceivedFIS); + uint64_t command_list_paddr = fis_paddr + sizeof(ReceivedFIS); m_port->clb = command_list_paddr & 0xFFFFFFFF; m_port->clbu = command_list_paddr >> 32; @@ -236,8 +236,9 @@ namespace Kernel volatile auto& command_table = *reinterpret_cast(m_dma_region->paddr_to_vaddr(command_header.ctba)); memset(const_cast(&command_table), 0x00, sizeof(HBACommandTable)); - command_table.prdt_entry[0].dba = m_data_dma_region->paddr() & 0xFFFFFFFF; - command_table.prdt_entry[0].dbau = m_data_dma_region->paddr() >> 32; + uint64_t data_dma_paddr64 = m_data_dma_region->paddr(); + command_table.prdt_entry[0].dba = data_dma_paddr64 & 0xFFFFFFFF; + command_table.prdt_entry[0].dbau = data_dma_paddr64 >> 32; command_table.prdt_entry[0].dbc = sector_count * sector_size() - 1; command_table.prdt_entry[0].i = 1;