diff options
author | Sahan Fernando <sahan.h.fernando@gmail.com> | 2021-04-24 11:30:27 +1000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-13 10:00:42 +0200 |
commit | 8131c0de8cae36cb0db778b3a46faf6a48701070 (patch) | |
tree | f01e9715c4327ed63c75a51cf7d95d220bd637ea /Kernel/Storage/AHCIPort.cpp | |
parent | b63b15eeb5654ba3126dfd0bfc58f7663878da51 (diff) | |
download | serenity-8131c0de8cae36cb0db778b3a46faf6a48701070.zip |
Kernel: Move AHCIPort::ScatterList to VM::ScatterGatherList
We want to move this out of the AHCI subsystem into the VM system,
since other parts of the kernel may need to perform scatter-gather IO.
We rename the current VM::ScatterGatherList impl that's used in the
virtio subsystem to VM::ScatterGatherRefList, since its distinguishing
feature from the AHCI scatter-gather list is that it doesn't own its
buffers.
Diffstat (limited to 'Kernel/Storage/AHCIPort.cpp')
-rw-r--r-- | Kernel/Storage/AHCIPort.cpp | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/Kernel/Storage/AHCIPort.cpp b/Kernel/Storage/AHCIPort.cpp index e6c9b8faa1..0899cb000b 100644 --- a/Kernel/Storage/AHCIPort.cpp +++ b/Kernel/Storage/AHCIPort.cpp @@ -11,22 +11,12 @@ #include <Kernel/Storage/SATADiskDevice.h> #include <Kernel/VM/AnonymousVMObject.h> #include <Kernel/VM/MemoryManager.h> +#include <Kernel/VM/ScatterGatherList.h> #include <Kernel/VM/TypedMapping.h> #include <Kernel/WorkQueue.h> namespace Kernel { -NonnullRefPtr<AHCIPort::ScatterList> AHCIPort::ScatterList::create(AsyncBlockDeviceRequest& request, NonnullRefPtrVector<PhysicalPage> allocated_pages, size_t device_block_size) -{ - return adopt_ref(*new ScatterList(request, allocated_pages, device_block_size)); -} - -AHCIPort::ScatterList::ScatterList(AsyncBlockDeviceRequest& request, NonnullRefPtrVector<PhysicalPage> allocated_pages, size_t device_block_size) - : m_vm_object(AnonymousVMObject::create_with_physical_pages(allocated_pages)) -{ - m_dma_region = MM.allocate_kernel_region_with_vmobject(m_vm_object, page_round_up((request.block_count() * device_block_size)), "AHCI Scattered DMA", Region::Access::Read | Region::Access::Write, Region::Cacheable::Yes); -} - NonnullRefPtr<AHCIPort> AHCIPort::create(const AHCIPortHandler& handler, volatile AHCI::PortRegisters& registers, u32 port_index) { return adopt_ref(*new AHCIPort(handler, registers, port_index)); @@ -443,7 +433,7 @@ Optional<AsyncDeviceRequest::RequestResult> AHCIPort::prepare_and_set_scatter_li allocated_dma_regions.append(m_dma_buffers.at(index)); } - m_current_scatter_list = ScatterList::create(request, allocated_dma_regions, m_connected_device->block_size()); + m_current_scatter_list = ScatterGatherList::create(request, allocated_dma_regions, m_connected_device->block_size()); if (request.request_type() == AsyncBlockDeviceRequest::Write) { if (!request.read_from_buffer(request.buffer(), m_current_scatter_list->dma_region().as_ptr(), m_connected_device->block_size() * request.block_count())) { return AsyncDeviceRequest::MemoryFault; |