mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Kernel/PCI: Remove InterruptDisabler usage
Instead, just ensure we pick the m_access_lock and then m_scan_lock when doing a scan/re-scan of the PCI configuration space so we know nobody can actually access the PCI configuration space during the scan. The m_scan_lock is now a Spinlock, to ensure we cannot yield to other process while we do the PCI configuration space scanning.
This commit is contained in:
parent
72e831e9e9
commit
8e55c4bfaf
Notes:
sideshowbarker
2024-07-18 01:58:21 +09:00
Author: https://github.com/supercomputer7 Commit: https://github.com/SerenityOS/serenity/commit/8e55c4bfaf9 Pull-request: https://github.com/SerenityOS/serenity/pull/10577
2 changed files with 7 additions and 6 deletions
|
@ -8,7 +8,6 @@
|
|||
#include <AK/HashTable.h>
|
||||
#include <Kernel/API/KResult.h>
|
||||
#include <Kernel/Arch/x86/IO.h>
|
||||
#include <Kernel/Arch/x86/InterruptDisabler.h>
|
||||
#include <Kernel/Bus/PCI/Access.h>
|
||||
#include <Kernel/Debug.h>
|
||||
#include <Kernel/Firmware/ACPI/Definitions.h>
|
||||
|
@ -40,7 +39,6 @@ UNMAP_AFTER_INIT bool Access::initialize_for_memory_access(PhysicalAddress mcfg_
|
|||
if (Access::is_initialized())
|
||||
return false;
|
||||
|
||||
InterruptDisabler disabler;
|
||||
auto* access = new Access(Access::AccessType::Memory);
|
||||
if (!access->search_pci_domains_from_acpi_mcfg_table(mcfg_table))
|
||||
return false;
|
||||
|
@ -307,7 +305,8 @@ u32 Access::read32_field(Address address, u32 field)
|
|||
|
||||
UNMAP_AFTER_INIT void Access::rescan_hardware_with_memory_addressing()
|
||||
{
|
||||
MutexLocker locker(m_scan_lock);
|
||||
MutexLocker locker(m_access_lock);
|
||||
SpinlockLocker scan_locker(m_scan_lock);
|
||||
VERIFY(m_device_identifiers.is_empty());
|
||||
VERIFY(!m_domains.is_empty());
|
||||
VERIFY(m_access_type == AccessType::Memory);
|
||||
|
@ -330,7 +329,8 @@ UNMAP_AFTER_INIT void Access::rescan_hardware_with_memory_addressing()
|
|||
|
||||
UNMAP_AFTER_INIT void Access::rescan_hardware_with_io_addressing()
|
||||
{
|
||||
MutexLocker locker(m_scan_lock);
|
||||
MutexLocker locker(m_access_lock);
|
||||
SpinlockLocker scan_locker(m_scan_lock);
|
||||
VERIFY(m_device_identifiers.is_empty());
|
||||
VERIFY(m_access_type == AccessType::IO);
|
||||
dbgln_if(PCI_DEBUG, "PCI: IO enumerating hardware");
|
||||
|
@ -456,7 +456,7 @@ UNMAP_AFTER_INIT void Access::enumerate_bus(int type, u8 bus, bool recursive)
|
|||
|
||||
void Access::fast_enumerate(Function<void(DeviceIdentifier const&)>& callback) const
|
||||
{
|
||||
MutexLocker locker(m_scan_lock);
|
||||
MutexLocker locker(m_access_lock);
|
||||
VERIFY(!m_device_identifiers.is_empty());
|
||||
for (auto& device_identifier : m_device_identifiers) {
|
||||
callback(device_identifier);
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <AK/Vector.h>
|
||||
#include <Kernel/Bus/PCI/Definitions.h>
|
||||
#include <Kernel/FileSystem/SysFS.h>
|
||||
#include <Kernel/Locking/Spinlock.h>
|
||||
|
||||
namespace Kernel::PCI {
|
||||
|
||||
|
@ -82,7 +83,7 @@ private:
|
|||
|
||||
// General Data-members
|
||||
mutable Mutex m_access_lock;
|
||||
mutable Mutex m_scan_lock;
|
||||
mutable Spinlock m_scan_lock;
|
||||
Bitmap m_enumerated_buses;
|
||||
AccessType m_access_type;
|
||||
Vector<DeviceIdentifier> m_device_identifiers;
|
||||
|
|
Loading…
Reference in a new issue