summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Bus/PCI/Access.cpp18
-rw-r--r--Kernel/Bus/PCI/Access.h5
2 files changed, 11 insertions, 12 deletions
diff --git a/Kernel/Bus/PCI/Access.cpp b/Kernel/Bus/PCI/Access.cpp
index 01f60168a0..bd4ee02a18 100644
--- a/Kernel/Bus/PCI/Access.cpp
+++ b/Kernel/Bus/PCI/Access.cpp
@@ -110,7 +110,7 @@ UNMAP_AFTER_INIT bool Access::initialize_for_one_pci_domain()
void Access::add_host_controller_and_enumerate_attached_devices(NonnullOwnPtr<HostController> controller, Function<void(DeviceIdentifier const&)> callback)
{
- MutexLocker locker(m_access_lock);
+ SpinlockLocker locker(m_access_lock);
SpinlockLocker scan_locker(m_scan_lock);
auto domain_number = controller->domain_number();
@@ -137,7 +137,7 @@ UNMAP_AFTER_INIT Access::Access()
UNMAP_AFTER_INIT void Access::rescan_hardware()
{
- MutexLocker locker(m_access_lock);
+ SpinlockLocker locker(m_access_lock);
SpinlockLocker scan_locker(m_scan_lock);
VERIFY(m_device_identifiers.is_empty());
for (auto it = m_host_controllers.begin(); it != m_host_controllers.end(); ++it) {
@@ -149,7 +149,7 @@ UNMAP_AFTER_INIT void Access::rescan_hardware()
void Access::fast_enumerate(Function<void(DeviceIdentifier const&)>& callback) const
{
- MutexLocker locker(m_access_lock);
+ SpinlockLocker locker(m_access_lock);
VERIFY(!m_device_identifiers.is_empty());
for (auto const& device_identifier : m_device_identifiers) {
callback(device_identifier);
@@ -171,21 +171,21 @@ DeviceIdentifier Access::get_device_identifier(Address address) const
void Access::write8_field(Address address, u32 field, u8 value)
{
- MutexLocker lock(m_access_lock);
+ SpinlockLocker locker(m_access_lock);
VERIFY(m_host_controllers.contains(address.domain()));
auto& controller = *m_host_controllers.get(address.domain()).value();
controller.write8_field(address.bus(), address.device(), address.function(), field, value);
}
void Access::write16_field(Address address, u32 field, u16 value)
{
- MutexLocker lock(m_access_lock);
+ SpinlockLocker locker(m_access_lock);
VERIFY(m_host_controllers.contains(address.domain()));
auto& controller = *m_host_controllers.get(address.domain()).value();
controller.write16_field(address.bus(), address.device(), address.function(), field, value);
}
void Access::write32_field(Address address, u32 field, u32 value)
{
- MutexLocker lock(m_access_lock);
+ SpinlockLocker locker(m_access_lock);
VERIFY(m_host_controllers.contains(address.domain()));
auto& controller = *m_host_controllers.get(address.domain()).value();
controller.write32_field(address.bus(), address.device(), address.function(), field, value);
@@ -202,21 +202,21 @@ u16 Access::read16_field(Address address, RegisterOffset field)
u8 Access::read8_field(Address address, u32 field)
{
- MutexLocker lock(m_access_lock);
+ SpinlockLocker locker(m_access_lock);
VERIFY(m_host_controllers.contains(address.domain()));
auto& controller = *m_host_controllers.get(address.domain()).value();
return controller.read8_field(address.bus(), address.device(), address.function(), field);
}
u16 Access::read16_field(Address address, u32 field)
{
- MutexLocker lock(m_access_lock);
+ SpinlockLocker locker(m_access_lock);
VERIFY(m_host_controllers.contains(address.domain()));
auto& controller = *m_host_controllers.get(address.domain()).value();
return controller.read16_field(address.bus(), address.device(), address.function(), field);
}
u32 Access::read32_field(Address address, u32 field)
{
- MutexLocker lock(m_access_lock);
+ SpinlockLocker locker(m_access_lock);
VERIFY(m_host_controllers.contains(address.domain()));
auto& controller = *m_host_controllers.get(address.domain()).value();
return controller.read32_field(address.bus(), address.device(), address.function(), field);
diff --git a/Kernel/Bus/PCI/Access.h b/Kernel/Bus/PCI/Access.h
index 0c9be8c064..f5c42c625c 100644
--- a/Kernel/Bus/PCI/Access.h
+++ b/Kernel/Bus/PCI/Access.h
@@ -36,7 +36,7 @@ public:
DeviceIdentifier get_device_identifier(Address address) const;
Spinlock const& scan_lock() const { return m_scan_lock; }
- Mutex const& access_lock() const { return m_access_lock; }
+ RecursiveSpinlock const& access_lock() const { return m_access_lock; }
void add_host_controller_and_enumerate_attached_devices(NonnullOwnPtr<HostController>, Function<void(DeviceIdentifier const&)> callback);
@@ -51,8 +51,7 @@ private:
Vector<Capability> get_capabilities(Address);
Optional<u8> get_capabilities_pointer(Address address);
- // General Data-members
- mutable Mutex m_access_lock;
+ mutable RecursiveSpinlock m_access_lock;
mutable Spinlock m_scan_lock;
HashMap<u32, NonnullOwnPtr<HostController>> m_host_controllers;