Skip to content

Commit

Permalink
Kernel: Rename Memory::PhysicalPage to Memory::PhysicalRAMPage
Browse files Browse the repository at this point in the history
Since these are now only used to represent RAM pages, (and not MMIO
pages) rename them to make their purpose more obvious.
  • Loading branch information
IdanHo committed May 17, 2024
1 parent 640de85 commit 211b638
Show file tree
Hide file tree
Showing 46 changed files with 192 additions and 192 deletions.
8 changes: 4 additions & 4 deletions Kernel/Arch/aarch64/PageDirectory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ UNMAP_AFTER_INIT void PageDirectory::allocate_kernel_directory()
{
// Adopt the page tables already set up by boot.S
dmesgln("MM: boot_pml4t @ {}", boot_pml4t);
m_root_table = PhysicalPage::create(boot_pml4t, MayReturnToFreeList::No);
m_root_table = PhysicalRAMPage::create(boot_pml4t, MayReturnToFreeList::No);
dmesgln("MM: boot_pdpt @ {}", boot_pdpt);
dmesgln("MM: boot_pd0 @ {}", boot_pd0);
dmesgln("MM: boot_pd_kernel @ {}", boot_pd_kernel);
m_directory_table = PhysicalPage::create(boot_pdpt, MayReturnToFreeList::No);
m_directory_pages[0] = PhysicalPage::create(boot_pd0, MayReturnToFreeList::No);
m_directory_pages[(kernel_mapping_base >> 30) & 0x1ff] = PhysicalPage::create(boot_pd_kernel, MayReturnToFreeList::No);
m_directory_table = PhysicalRAMPage::create(boot_pdpt, MayReturnToFreeList::No);
m_directory_pages[0] = PhysicalRAMPage::create(boot_pd0, MayReturnToFreeList::No);
m_directory_pages[(kernel_mapping_base >> 30) & 0x1ff] = PhysicalRAMPage::create(boot_pd_kernel, MayReturnToFreeList::No);
}

PageDirectory::~PageDirectory()
Expand Down
8 changes: 4 additions & 4 deletions Kernel/Arch/aarch64/PageDirectory.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <Kernel/Forward.h>
#include <Kernel/Locking/Spinlock.h>
#include <Kernel/Memory/PhysicalAddress.h>
#include <Kernel/Memory/PhysicalPage.h>
#include <Kernel/Memory/PhysicalRAMPage.h>

namespace Kernel::Memory {

Expand Down Expand Up @@ -211,9 +211,9 @@ class PageDirectory final : public AtomicRefCounted<PageDirectory> {
static void deregister_page_directory(PageDirectory* directory);

Process* m_process { nullptr };
RefPtr<PhysicalPage> m_root_table;
RefPtr<PhysicalPage> m_directory_table;
RefPtr<PhysicalPage> m_directory_pages[512];
RefPtr<PhysicalRAMPage> m_root_table;
RefPtr<PhysicalRAMPage> m_directory_table;
RefPtr<PhysicalRAMPage> m_directory_pages[512];
RecursiveSpinlock<LockRank::None> m_lock {};
};

Expand Down
4 changes: 2 additions & 2 deletions Kernel/Arch/riscv64/PageDirectory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ UNMAP_AFTER_INIT void PageDirectory::allocate_kernel_directory()
{
dmesgln("MM: boot_pdpt @ {}", boot_pdpt);
dmesgln("MM: boot_pd_kernel @ {}", boot_pd_kernel);
m_directory_table = PhysicalPage::create(boot_pdpt, MayReturnToFreeList::No);
m_directory_pages[(kernel_mapping_base >> VPN_2_OFFSET) & PAGE_TABLE_INDEX_MASK] = PhysicalPage::create(boot_pd_kernel, MayReturnToFreeList::No);
m_directory_table = PhysicalRAMPage::create(boot_pdpt, MayReturnToFreeList::No);
m_directory_pages[(kernel_mapping_base >> VPN_2_OFFSET) & PAGE_TABLE_INDEX_MASK] = PhysicalRAMPage::create(boot_pd_kernel, MayReturnToFreeList::No);
}

PageDirectory::~PageDirectory()
Expand Down
6 changes: 3 additions & 3 deletions Kernel/Arch/riscv64/PageDirectory.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <Kernel/Forward.h>
#include <Kernel/Locking/Spinlock.h>
#include <Kernel/Memory/PhysicalAddress.h>
#include <Kernel/Memory/PhysicalPage.h>
#include <Kernel/Memory/PhysicalRAMPage.h>

#include <AK/Platform.h>
VALIDATE_IS_RISCV64()
Expand Down Expand Up @@ -197,8 +197,8 @@ class PageDirectory final : public AtomicRefCounted<PageDirectory> {
static void deregister_page_directory(PageDirectory* directory);

Process* m_process { nullptr };
RefPtr<PhysicalPage> m_directory_table;
RefPtr<PhysicalPage> m_directory_pages[512];
RefPtr<PhysicalRAMPage> m_directory_table;
RefPtr<PhysicalRAMPage> m_directory_pages[512];
RecursiveSpinlock<LockRank::None> m_lock {};
};

Expand Down
8 changes: 4 additions & 4 deletions Kernel/Arch/x86_64/PageDirectory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,13 @@ UNMAP_AFTER_INIT void PageDirectory::allocate_kernel_directory()
{
// Adopt the page tables already set up by boot.S
dmesgln("MM: boot_pml4t @ {}", boot_pml4t);
m_pml4t = PhysicalPage::create(boot_pml4t, MayReturnToFreeList::No);
m_pml4t = PhysicalRAMPage::create(boot_pml4t, MayReturnToFreeList::No);
dmesgln("MM: boot_pdpt @ {}", boot_pdpt);
dmesgln("MM: boot_pd0 @ {}", boot_pd0);
dmesgln("MM: boot_pd_kernel @ {}", boot_pd_kernel);
m_directory_table = PhysicalPage::create(boot_pdpt, MayReturnToFreeList::No);
m_directory_pages[0] = PhysicalPage::create(boot_pd0, MayReturnToFreeList::No);
m_directory_pages[(kernel_mapping_base >> 30) & 0x1ff] = PhysicalPage::create(boot_pd_kernel, MayReturnToFreeList::No);
m_directory_table = PhysicalRAMPage::create(boot_pdpt, MayReturnToFreeList::No);
m_directory_pages[0] = PhysicalRAMPage::create(boot_pd0, MayReturnToFreeList::No);
m_directory_pages[(kernel_mapping_base >> 30) & 0x1ff] = PhysicalRAMPage::create(boot_pd_kernel, MayReturnToFreeList::No);
}

PageDirectory::~PageDirectory()
Expand Down
8 changes: 4 additions & 4 deletions Kernel/Arch/x86_64/PageDirectory.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <Kernel/Locking/LockRank.h>
#include <Kernel/Locking/Spinlock.h>
#include <Kernel/Memory/PhysicalAddress.h>
#include <Kernel/Memory/PhysicalPage.h>
#include <Kernel/Memory/PhysicalRAMPage.h>

namespace Kernel::Memory {

Expand Down Expand Up @@ -193,9 +193,9 @@ class PageDirectory final : public AtomicRefCounted<PageDirectory> {
static void deregister_page_directory(PageDirectory* directory);

Process* m_process { nullptr };
RefPtr<PhysicalPage> m_pml4t;
RefPtr<PhysicalPage> m_directory_table;
RefPtr<PhysicalPage> m_directory_pages[512];
RefPtr<PhysicalRAMPage> m_pml4t;
RefPtr<PhysicalRAMPage> m_directory_table;
RefPtr<PhysicalRAMPage> m_directory_pages[512];
RecursiveSpinlock<LockRank::None> m_lock {};
};

Expand Down
2 changes: 1 addition & 1 deletion Kernel/Bus/USB/USBTransfer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <Kernel/Bus/USB/USBPipe.h>
#include <Kernel/Library/LockRefPtr.h>
#include <Kernel/Memory/AnonymousVMObject.h>
#include <Kernel/Memory/PhysicalPage.h>
#include <Kernel/Memory/PhysicalRAMPage.h>
#include <Kernel/Memory/Region.h>

// TODO: Callback stuff in this class please!
Expand Down
2 changes: 1 addition & 1 deletion Kernel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ set(KERNEL_SOURCES
Memory/InodeVMObject.cpp
Memory/MemoryManager.cpp
Memory/MMIOVMObject.cpp
Memory/PhysicalPage.cpp
Memory/PhysicalRAMPage.cpp
Memory/PhysicalRegion.cpp
Memory/PhysicalZone.cpp
Memory/PrivateInodeVMObject.cpp
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Devices/Storage/AHCI/InterruptHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <Kernel/Library/LockRefPtr.h>
#include <Kernel/Locking/Mutex.h>
#include <Kernel/Memory/PhysicalAddress.h>
#include <Kernel/Memory/PhysicalPage.h>
#include <Kernel/Memory/PhysicalRAMPage.h>
#include <Kernel/Sections.h>
#include <Kernel/Security/Random.h>
#include <Kernel/Tasks/WaitQueue.h>
Expand Down
4 changes: 2 additions & 2 deletions Kernel/Devices/Storage/AHCI/Port.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ ErrorOr<void> AHCIPort::allocate_resources_and_initialize_ports()
return {};
}

UNMAP_AFTER_INIT AHCIPort::AHCIPort(AHCIController const& controller, NonnullRefPtr<Memory::PhysicalPage> identify_buffer_page, AHCI::HBADefinedCapabilities hba_capabilities, volatile AHCI::PortRegisters& registers, u32 port_index)
UNMAP_AFTER_INIT AHCIPort::AHCIPort(AHCIController const& controller, NonnullRefPtr<Memory::PhysicalRAMPage> identify_buffer_page, AHCI::HBADefinedCapabilities hba_capabilities, volatile AHCI::PortRegisters& registers, u32 port_index)
: m_port_index(port_index)
, m_hba_capabilities(hba_capabilities)
, m_identify_buffer_page(move(identify_buffer_page))
Expand Down Expand Up @@ -413,7 +413,7 @@ Optional<AsyncDeviceRequest::RequestResult> AHCIPort::prepare_and_set_scatter_li
VERIFY(m_lock.is_locked());
VERIFY(request.block_count() > 0);

Vector<NonnullRefPtr<Memory::PhysicalPage>> allocated_dma_regions;
Vector<NonnullRefPtr<Memory::PhysicalRAMPage>> allocated_dma_regions;
for (size_t index = 0; index < calculate_descriptors_count(request.block_count()); index++) {
allocated_dma_regions.append(m_dma_buffers.at(index));
}
Expand Down
14 changes: 7 additions & 7 deletions Kernel/Devices/Storage/AHCI/Port.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <Kernel/Locking/Spinlock.h>
#include <Kernel/Memory/AnonymousVMObject.h>
#include <Kernel/Memory/PhysicalAddress.h>
#include <Kernel/Memory/PhysicalPage.h>
#include <Kernel/Memory/PhysicalRAMPage.h>
#include <Kernel/Memory/ScatterGatherList.h>
#include <Kernel/Sections.h>
#include <Kernel/Security/Random.h>
Expand Down Expand Up @@ -55,7 +55,7 @@ class AHCIPort
bool is_phy_enabled() const { return (m_port_registers.ssts & 0xf) == 3; }
bool initialize();

AHCIPort(AHCIController const&, NonnullRefPtr<Memory::PhysicalPage> identify_buffer_page, AHCI::HBADefinedCapabilities, volatile AHCI::PortRegisters&, u32 port_index);
AHCIPort(AHCIController const&, NonnullRefPtr<Memory::PhysicalRAMPage> identify_buffer_page, AHCI::HBADefinedCapabilities, volatile AHCI::PortRegisters&, u32 port_index);

ALWAYS_INLINE void clear_sata_error_register() const;

Expand Down Expand Up @@ -108,11 +108,11 @@ class AHCIPort

mutable bool m_wait_for_completion { false };

Vector<NonnullRefPtr<Memory::PhysicalPage>> m_dma_buffers;
Vector<NonnullRefPtr<Memory::PhysicalPage>> m_command_table_pages;
RefPtr<Memory::PhysicalPage> m_command_list_page;
Vector<NonnullRefPtr<Memory::PhysicalRAMPage>> m_dma_buffers;
Vector<NonnullRefPtr<Memory::PhysicalRAMPage>> m_command_table_pages;
RefPtr<Memory::PhysicalRAMPage> m_command_list_page;
OwnPtr<Memory::Region> m_command_list_region;
RefPtr<Memory::PhysicalPage> m_fis_receive_page;
RefPtr<Memory::PhysicalRAMPage> m_fis_receive_page;
LockRefPtr<ATADevice> m_connected_device;

u32 m_port_index;
Expand All @@ -122,7 +122,7 @@ class AHCIPort
// it's probably better to just "cache" this here instead.
AHCI::HBADefinedCapabilities const m_hba_capabilities;

NonnullRefPtr<Memory::PhysicalPage> const m_identify_buffer_page;
NonnullRefPtr<Memory::PhysicalRAMPage> const m_identify_buffer_page;

volatile AHCI::PortRegisters& m_port_registers;
NonnullRefPtr<AHCIController> const m_parent_controller;
Expand Down
12 changes: 6 additions & 6 deletions Kernel/Devices/Storage/NVMe/NVMeController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ UNMAP_AFTER_INIT void NVMeController::set_admin_q_depth()
UNMAP_AFTER_INIT ErrorOr<void> NVMeController::identify_and_init_namespaces()
{

RefPtr<Memory::PhysicalPage> prp_dma_buffer;
RefPtr<Memory::PhysicalRAMPage> prp_dma_buffer;
OwnPtr<Memory::Region> prp_dma_region;
auto namespace_data_struct = TRY(ByteBuffer::create_zeroed(NVMe_IDENTIFY_SIZE));
u32 active_namespace_list[NVMe_IDENTIFY_SIZE / sizeof(u32)];
Expand Down Expand Up @@ -219,7 +219,7 @@ UNMAP_AFTER_INIT ErrorOr<void> NVMeController::identify_and_init_namespaces()

ErrorOr<void> NVMeController::identify_and_init_controller()
{
RefPtr<Memory::PhysicalPage> prp_dma_buffer;
RefPtr<Memory::PhysicalRAMPage> prp_dma_buffer;
OwnPtr<Memory::Region> prp_dma_region;
IdentifyController ctrl {};

Expand Down Expand Up @@ -311,9 +311,9 @@ void NVMeController::complete_current_request([[maybe_unused]] AsyncDeviceReques
UNMAP_AFTER_INIT ErrorOr<void> NVMeController::create_admin_queue(QueueType queue_type)
{
OwnPtr<Memory::Region> cq_dma_region;
Vector<NonnullRefPtr<Memory::PhysicalPage>> cq_dma_pages;
Vector<NonnullRefPtr<Memory::PhysicalRAMPage>> cq_dma_pages;
OwnPtr<Memory::Region> sq_dma_region;
Vector<NonnullRefPtr<Memory::PhysicalPage>> sq_dma_pages;
Vector<NonnullRefPtr<Memory::PhysicalRAMPage>> sq_dma_pages;
set_admin_q_depth();
auto cq_size = round_up_to_power_of_two(CQ_SIZE(ADMIN_QUEUE_SIZE), 4096);
auto sq_size = round_up_to_power_of_two(SQ_SIZE(ADMIN_QUEUE_SIZE), 4096);
Expand Down Expand Up @@ -364,9 +364,9 @@ UNMAP_AFTER_INIT ErrorOr<void> NVMeController::create_admin_queue(QueueType queu
UNMAP_AFTER_INIT ErrorOr<void> NVMeController::create_io_queue(u8 qid, QueueType queue_type)
{
OwnPtr<Memory::Region> cq_dma_region;
Vector<NonnullRefPtr<Memory::PhysicalPage>> cq_dma_pages;
Vector<NonnullRefPtr<Memory::PhysicalRAMPage>> cq_dma_pages;
OwnPtr<Memory::Region> sq_dma_region;
Vector<NonnullRefPtr<Memory::PhysicalPage>> sq_dma_pages;
Vector<NonnullRefPtr<Memory::PhysicalRAMPage>> sq_dma_pages;
auto cq_size = round_up_to_power_of_two(CQ_SIZE(IO_QUEUE_SIZE), 4096);
auto sq_size = round_up_to_power_of_two(SQ_SIZE(IO_QUEUE_SIZE), 4096);

Expand Down
4 changes: 2 additions & 2 deletions Kernel/Devices/Storage/NVMe/NVMeController.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ class NVMeController : public PCI::Device
Vector<NonnullLockRefPtr<NVMeQueue>> m_queues;
Vector<NonnullLockRefPtr<NVMeNameSpace>> m_namespaces;
Memory::TypedMapping<ControllerRegister volatile> m_controller_regs;
RefPtr<Memory::PhysicalPage> m_dbbuf_shadow_page;
RefPtr<Memory::PhysicalPage> m_dbbuf_eventidx_page;
RefPtr<Memory::PhysicalRAMPage> m_dbbuf_shadow_page;
RefPtr<Memory::PhysicalRAMPage> m_dbbuf_eventidx_page;
bool m_admin_queue_ready { false };
size_t m_device_count { 0 };
AK::Duration m_ready_timeout;
Expand Down
4 changes: 2 additions & 2 deletions Kernel/Devices/Storage/NVMe/NVMeInterruptQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@

namespace Kernel {

ErrorOr<NonnullLockRefPtr<NVMeInterruptQueue>> NVMeInterruptQueue::try_create(PCI::Device& device, NonnullOwnPtr<Memory::Region> rw_dma_region, NonnullRefPtr<Memory::PhysicalPage> rw_dma_page, u16 qid, u8 irq, u32 q_depth, OwnPtr<Memory::Region> cq_dma_region, OwnPtr<Memory::Region> sq_dma_region, Doorbell db_regs)
ErrorOr<NonnullLockRefPtr<NVMeInterruptQueue>> NVMeInterruptQueue::try_create(PCI::Device& device, NonnullOwnPtr<Memory::Region> rw_dma_region, NonnullRefPtr<Memory::PhysicalRAMPage> rw_dma_page, u16 qid, u8 irq, u32 q_depth, OwnPtr<Memory::Region> cq_dma_region, OwnPtr<Memory::Region> sq_dma_region, Doorbell db_regs)
{
auto queue = TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) NVMeInterruptQueue(device, move(rw_dma_region), rw_dma_page, qid, irq, q_depth, move(cq_dma_region), move(sq_dma_region), move(db_regs))));
queue->initialize_interrupt_queue();
return queue;
}

UNMAP_AFTER_INIT NVMeInterruptQueue::NVMeInterruptQueue(PCI::Device& device, NonnullOwnPtr<Memory::Region> rw_dma_region, NonnullRefPtr<Memory::PhysicalPage> rw_dma_page, u16 qid, u8 irq, u32 q_depth, OwnPtr<Memory::Region> cq_dma_region, OwnPtr<Memory::Region> sq_dma_region, Doorbell db_regs)
UNMAP_AFTER_INIT NVMeInterruptQueue::NVMeInterruptQueue(PCI::Device& device, NonnullOwnPtr<Memory::Region> rw_dma_region, NonnullRefPtr<Memory::PhysicalRAMPage> rw_dma_page, u16 qid, u8 irq, u32 q_depth, OwnPtr<Memory::Region> cq_dma_region, OwnPtr<Memory::Region> sq_dma_region, Doorbell db_regs)
: NVMeQueue(move(rw_dma_region), rw_dma_page, qid, q_depth, move(cq_dma_region), move(sq_dma_region), move(db_regs))
, PCI::IRQHandler(device, irq)
{
Expand Down
4 changes: 2 additions & 2 deletions Kernel/Devices/Storage/NVMe/NVMeInterruptQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ namespace Kernel {
class NVMeInterruptQueue : public NVMeQueue
, public PCI::IRQHandler {
public:
static ErrorOr<NonnullLockRefPtr<NVMeInterruptQueue>> try_create(PCI::Device& device, NonnullOwnPtr<Memory::Region> rw_dma_region, NonnullRefPtr<Memory::PhysicalPage> rw_dma_page, u16 qid, u8 irq, u32 q_depth, OwnPtr<Memory::Region> cq_dma_region, OwnPtr<Memory::Region> sq_dma_region, Doorbell db_regs);
static ErrorOr<NonnullLockRefPtr<NVMeInterruptQueue>> try_create(PCI::Device& device, NonnullOwnPtr<Memory::Region> rw_dma_region, NonnullRefPtr<Memory::PhysicalRAMPage> rw_dma_page, u16 qid, u8 irq, u32 q_depth, OwnPtr<Memory::Region> cq_dma_region, OwnPtr<Memory::Region> sq_dma_region, Doorbell db_regs);
void submit_sqe(NVMeSubmission& submission) override;
virtual ~NVMeInterruptQueue() override {};
virtual StringView purpose() const override { return "NVMe"sv; }
void initialize_interrupt_queue();

protected:
NVMeInterruptQueue(PCI::Device& device, NonnullOwnPtr<Memory::Region> rw_dma_region, NonnullRefPtr<Memory::PhysicalPage> rw_dma_page, u16 qid, u8 irq, u32 q_depth, OwnPtr<Memory::Region> cq_dma_region, OwnPtr<Memory::Region> sq_dma_region, Doorbell db_regs);
NVMeInterruptQueue(PCI::Device& device, NonnullOwnPtr<Memory::Region> rw_dma_region, NonnullRefPtr<Memory::PhysicalRAMPage> rw_dma_page, u16 qid, u8 irq, u32 q_depth, OwnPtr<Memory::Region> cq_dma_region, OwnPtr<Memory::Region> sq_dma_region, Doorbell db_regs);

private:
virtual void complete_current_request(u16 cmdid, u16 status) override;
Expand Down
4 changes: 2 additions & 2 deletions Kernel/Devices/Storage/NVMe/NVMePollQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@

namespace Kernel {

ErrorOr<NonnullLockRefPtr<NVMePollQueue>> NVMePollQueue::try_create(NonnullOwnPtr<Memory::Region> rw_dma_region, NonnullRefPtr<Memory::PhysicalPage> rw_dma_page, u16 qid, u32 q_depth, OwnPtr<Memory::Region> cq_dma_region, OwnPtr<Memory::Region> sq_dma_region, Doorbell db_regs)
ErrorOr<NonnullLockRefPtr<NVMePollQueue>> NVMePollQueue::try_create(NonnullOwnPtr<Memory::Region> rw_dma_region, NonnullRefPtr<Memory::PhysicalRAMPage> rw_dma_page, u16 qid, u32 q_depth, OwnPtr<Memory::Region> cq_dma_region, OwnPtr<Memory::Region> sq_dma_region, Doorbell db_regs)
{
return TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) NVMePollQueue(move(rw_dma_region), rw_dma_page, qid, q_depth, move(cq_dma_region), move(sq_dma_region), move(db_regs))));
}

UNMAP_AFTER_INIT NVMePollQueue::NVMePollQueue(NonnullOwnPtr<Memory::Region> rw_dma_region, NonnullRefPtr<Memory::PhysicalPage> rw_dma_page, u16 qid, u32 q_depth, OwnPtr<Memory::Region> cq_dma_region, OwnPtr<Memory::Region> sq_dma_region, Doorbell db_regs)
UNMAP_AFTER_INIT NVMePollQueue::NVMePollQueue(NonnullOwnPtr<Memory::Region> rw_dma_region, NonnullRefPtr<Memory::PhysicalRAMPage> rw_dma_page, u16 qid, u32 q_depth, OwnPtr<Memory::Region> cq_dma_region, OwnPtr<Memory::Region> sq_dma_region, Doorbell db_regs)
: NVMeQueue(move(rw_dma_region), rw_dma_page, qid, q_depth, move(cq_dma_region), move(sq_dma_region), move(db_regs))
{
}
Expand Down
4 changes: 2 additions & 2 deletions Kernel/Devices/Storage/NVMe/NVMePollQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ namespace Kernel {

class NVMePollQueue : public NVMeQueue {
public:
static ErrorOr<NonnullLockRefPtr<NVMePollQueue>> try_create(NonnullOwnPtr<Memory::Region> rw_dma_region, NonnullRefPtr<Memory::PhysicalPage> rw_dma_page, u16 qid, u32 q_depth, OwnPtr<Memory::Region> cq_dma_region, OwnPtr<Memory::Region> sq_dma_region, Doorbell db_regs);
static ErrorOr<NonnullLockRefPtr<NVMePollQueue>> try_create(NonnullOwnPtr<Memory::Region> rw_dma_region, NonnullRefPtr<Memory::PhysicalRAMPage> rw_dma_page, u16 qid, u32 q_depth, OwnPtr<Memory::Region> cq_dma_region, OwnPtr<Memory::Region> sq_dma_region, Doorbell db_regs);
void submit_sqe(NVMeSubmission& submission) override;
virtual ~NVMePollQueue() override {};

protected:
NVMePollQueue(NonnullOwnPtr<Memory::Region> rw_dma_region, NonnullRefPtr<Memory::PhysicalPage> rw_dma_page, u16 qid, u32 q_depth, OwnPtr<Memory::Region> cq_dma_region, OwnPtr<Memory::Region> sq_dma_region, Doorbell db_regs);
NVMePollQueue(NonnullOwnPtr<Memory::Region> rw_dma_region, NonnullRefPtr<Memory::PhysicalRAMPage> rw_dma_page, u16 qid, u32 q_depth, OwnPtr<Memory::Region> cq_dma_region, OwnPtr<Memory::Region> sq_dma_region, Doorbell db_regs);

private:
Spinlock<LockRank::Interrupts> m_cq_lock {};
Expand Down
4 changes: 2 additions & 2 deletions Kernel/Devices/Storage/NVMe/NVMeQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Kernel {
ErrorOr<NonnullLockRefPtr<NVMeQueue>> NVMeQueue::try_create(NVMeController& device, u16 qid, Optional<u8> irq, u32 q_depth, OwnPtr<Memory::Region> cq_dma_region, OwnPtr<Memory::Region> sq_dma_region, Doorbell db_regs, QueueType queue_type)
{
// Note: Allocate DMA region for RW operation. For now the requests don't exceed more than 4096 bytes (Storage device takes care of it)
RefPtr<Memory::PhysicalPage> rw_dma_page;
RefPtr<Memory::PhysicalRAMPage> rw_dma_page;
auto rw_dma_region = TRY(MM.allocate_dma_buffer_page("NVMe Queue Read/Write DMA"sv, Memory::Region::Access::ReadWrite, rw_dma_page));

if (rw_dma_page.is_null())
Expand All @@ -30,7 +30,7 @@ ErrorOr<NonnullLockRefPtr<NVMeQueue>> NVMeQueue::try_create(NVMeController& devi
return queue;
}

UNMAP_AFTER_INIT NVMeQueue::NVMeQueue(NonnullOwnPtr<Memory::Region> rw_dma_region, Memory::PhysicalPage const& rw_dma_page, u16 qid, u32 q_depth, OwnPtr<Memory::Region> cq_dma_region, OwnPtr<Memory::Region> sq_dma_region, Doorbell db_regs)
UNMAP_AFTER_INIT NVMeQueue::NVMeQueue(NonnullOwnPtr<Memory::Region> rw_dma_region, Memory::PhysicalRAMPage const& rw_dma_page, u16 qid, u32 q_depth, OwnPtr<Memory::Region> cq_dma_region, OwnPtr<Memory::Region> sq_dma_region, Doorbell db_regs)
: m_rw_dma_region(move(rw_dma_region))
, m_qid(qid)
, m_admin_queue(qid == 0)
Expand Down

0 comments on commit 211b638

Please sign in to comment.