mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:18:12 +00:00
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.
This commit is contained in:
parent
b63b15eeb5
commit
8131c0de8c
11 changed files with 53 additions and 46 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue