mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-22 17:31:58 -05:00
d3a0ae5c57
This replaces all usages of Cacheable::Yes with MemoryType::Normal and Cacheable::No with either MemoryType::NonCacheable or MemoryType::IO, depending on the context. The Page{Directory,Table}::set_cache_disabled function therefore also has been replaced with a more appropriate set_memory_type_function. Adding a memory_type "getter" would not be as easy, as some architectures may not support all memory types, so getting the memory type again may be a lossy conversion. The is_cache_disabled function was never used, so just simply remove it altogether. There is no difference between MemoryType::NonCacheable and MemoryType::IO on x86 for now. Other architectures currently don't respect the MemoryType at all.
26 lines
1,018 B
C++
26 lines
1,018 B
C++
/*
|
|
* Copyright (c) 2021, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <Kernel/Memory/ScatterGatherList.h>
|
|
|
|
namespace Kernel::Memory {
|
|
|
|
ErrorOr<LockRefPtr<ScatterGatherList>> ScatterGatherList::try_create(AsyncBlockDeviceRequest& request, Span<NonnullRefPtr<PhysicalRAMPage>> allocated_pages, size_t device_block_size, StringView region_name)
|
|
{
|
|
auto vm_object = TRY(AnonymousVMObject::try_create_with_physical_pages(allocated_pages));
|
|
auto size = TRY(page_round_up((request.block_count() * device_block_size)));
|
|
auto region = TRY(MM.allocate_kernel_region_with_vmobject(vm_object, size, region_name, Region::Access::Read | Region::Access::Write, MemoryType::Normal));
|
|
|
|
return adopt_lock_ref_if_nonnull(new (nothrow) ScatterGatherList(vm_object, move(region)));
|
|
}
|
|
|
|
ScatterGatherList::ScatterGatherList(NonnullLockRefPtr<AnonymousVMObject> vm_object, NonnullOwnPtr<Region> dma_region)
|
|
: m_vm_object(move(vm_object))
|
|
, m_dma_region(move(dma_region))
|
|
{
|
|
}
|
|
|
|
}
|