mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:17:46 +00:00
Kernel: Use RefPtr instead of LockRefPtr for PhysicalPage
I believe this to be safe, as the main thing that LockRefPtr provides over RefPtr is safe copying from a shared LockRefPtr instance. I've inspected the uses of RefPtr<PhysicalPage> and it seems they're all guarded by external locking. Some of it is less obvious, but this is an area where we're making continuous headway.
This commit is contained in:
parent
5a804b9a1d
commit
2c72d495a3
33 changed files with 141 additions and 138 deletions
|
@ -54,7 +54,7 @@ ErrorOr<void> AHCIPort::allocate_resources_and_initialize_ports()
|
|||
return {};
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT AHCIPort::AHCIPort(AHCIController const& controller, NonnullLockRefPtr<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::PhysicalPage> 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))
|
||||
|
@ -496,7 +496,7 @@ Optional<AsyncDeviceRequest::RequestResult> AHCIPort::prepare_and_set_scatter_li
|
|||
VERIFY(m_lock.is_locked());
|
||||
VERIFY(request.block_count() > 0);
|
||||
|
||||
NonnullLockRefPtrVector<Memory::PhysicalPage> allocated_dma_regions;
|
||||
NonnullRefPtrVector<Memory::PhysicalPage> 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));
|
||||
}
|
||||
|
|
|
@ -6,10 +6,11 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/NonnullRefPtrVector.h>
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <Kernel/Devices/Device.h>
|
||||
#include <Kernel/Interrupts/IRQHandler.h>
|
||||
#include <Kernel/Library/LockRefPtr.h>
|
||||
#include <Kernel/Library/LockWeakPtr.h>
|
||||
#include <Kernel/Library/LockWeakable.h>
|
||||
#include <Kernel/Locking/Mutex.h>
|
||||
|
@ -56,7 +57,7 @@ private:
|
|||
bool is_phy_enabled() const { return (m_port_registers.ssts & 0xf) == 3; }
|
||||
bool initialize();
|
||||
|
||||
AHCIPort(AHCIController const&, NonnullLockRefPtr<Memory::PhysicalPage> identify_buffer_page, AHCI::HBADefinedCapabilities, volatile AHCI::PortRegisters&, u32 port_index);
|
||||
AHCIPort(AHCIController const&, NonnullRefPtr<Memory::PhysicalPage> identify_buffer_page, AHCI::HBADefinedCapabilities, volatile AHCI::PortRegisters&, u32 port_index);
|
||||
|
||||
ALWAYS_INLINE void clear_sata_error_register() const;
|
||||
|
||||
|
@ -111,11 +112,11 @@ private:
|
|||
|
||||
mutable bool m_wait_for_completion { false };
|
||||
|
||||
NonnullLockRefPtrVector<Memory::PhysicalPage> m_dma_buffers;
|
||||
NonnullLockRefPtrVector<Memory::PhysicalPage> m_command_table_pages;
|
||||
LockRefPtr<Memory::PhysicalPage> m_command_list_page;
|
||||
NonnullRefPtrVector<Memory::PhysicalPage> m_dma_buffers;
|
||||
NonnullRefPtrVector<Memory::PhysicalPage> m_command_table_pages;
|
||||
RefPtr<Memory::PhysicalPage> m_command_list_page;
|
||||
OwnPtr<Memory::Region> m_command_list_region;
|
||||
LockRefPtr<Memory::PhysicalPage> m_fis_receive_page;
|
||||
RefPtr<Memory::PhysicalPage> m_fis_receive_page;
|
||||
LockRefPtr<ATADevice> m_connected_device;
|
||||
|
||||
u32 m_port_index;
|
||||
|
@ -125,7 +126,7 @@ private:
|
|||
// it's probably better to just "cache" this here instead.
|
||||
AHCI::HBADefinedCapabilities const m_hba_capabilities;
|
||||
|
||||
NonnullLockRefPtr<Memory::PhysicalPage> m_identify_buffer_page;
|
||||
NonnullRefPtr<Memory::PhysicalPage> m_identify_buffer_page;
|
||||
|
||||
volatile AHCI::PortRegisters& m_port_registers;
|
||||
LockWeakPtr<AHCIController> m_parent_controller;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue