diff options
author | Pankaj Raghav <pankydev8@gmail.com> | 2022-03-26 18:39:47 +0100 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2022-03-27 08:54:32 -0700 |
commit | 4b2094506b136be79430439fcb159cedc6d1ad17 (patch) | |
tree | b26a9f46e52705e9224d5083d91b3e8f7d38c070 /Kernel/Storage/ATA | |
parent | 4ecc695a65a062865d27271cbd58cdebe3fe6d9a (diff) | |
download | serenity-4b2094506b136be79430439fcb159cedc6d1ad17.zip |
Kernel: Use buffer_size from AsyncBlockDevice struct
The underlying driver does not need to recalculate the buffer size as
it is passed in the AsyncBlockDevice struct anyway. This also helps in
removing any assumptions of the underlying block size of the device.
Diffstat (limited to 'Kernel/Storage/ATA')
-rw-r--r-- | Kernel/Storage/ATA/BMIDEChannel.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Kernel/Storage/ATA/BMIDEChannel.cpp b/Kernel/Storage/ATA/BMIDEChannel.cpp index b87b9c8854..f46251f53b 100644 --- a/Kernel/Storage/ATA/BMIDEChannel.cpp +++ b/Kernel/Storage/ATA/BMIDEChannel.cpp @@ -130,7 +130,7 @@ void BMIDEChannel::complete_current_request(AsyncDeviceRequest::RequestResult re if (result == AsyncDeviceRequest::Success) { if (current_request->request_type() == AsyncBlockDeviceRequest::Read) { - if (auto result = current_request->write_to_buffer(current_request->buffer(), m_dma_buffer_region->vaddr().as_ptr(), 512 * current_request->block_count()); result.is_error()) { + if (auto result = current_request->write_to_buffer(current_request->buffer(), m_dma_buffer_region->vaddr().as_ptr(), current_request->buffer_size()); result.is_error()) { lock.unlock(); current_request->complete(AsyncDeviceRequest::MemoryFault); return; @@ -157,9 +157,9 @@ void BMIDEChannel::ata_write_sectors(bool slave_request, u16 capabilities) dbgln_if(PATA_DEBUG, "BMIDEChannel::ata_write_sectors ({} x {})", m_current_request->block_index(), m_current_request->block_count()); prdt().offset = m_dma_buffer_page->paddr().get(); - prdt().size = 512 * m_current_request->block_count(); + prdt().size = m_current_request->buffer_size(); - if (auto result = m_current_request->read_from_buffer(m_current_request->buffer(), m_dma_buffer_region->vaddr().as_ptr(), 512 * m_current_request->block_count()); result.is_error()) { + if (auto result = m_current_request->read_from_buffer(m_current_request->buffer(), m_dma_buffer_region->vaddr().as_ptr(), m_current_request->buffer_size()); result.is_error()) { complete_current_request(AsyncDeviceRequest::MemoryFault); return; } @@ -210,7 +210,7 @@ void BMIDEChannel::ata_read_sectors(bool slave_request, u16 capabilities) IO::delay(10); prdt().offset = m_dma_buffer_page->paddr().get(); - prdt().size = 512 * m_current_request->block_count(); + prdt().size = m_current_request->buffer_size(); VERIFY(prdt().size <= PAGE_SIZE); |