diff options
author | Liav A <liavalb@gmail.com> | 2020-12-18 20:27:55 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-12-21 00:19:21 +0100 |
commit | cf0a12c68f0281cc21be4ed0c2b44255a6c5d33b (patch) | |
tree | 66574823ff790dccc1c9637af76d2820d58e91eb /Kernel | |
parent | 97b36febd5670550a209272db9587776c17237dd (diff) | |
download | serenity-cf0a12c68f0281cc21be4ed0c2b44255a6c5d33b.zip |
Kernel: Add various methods to handle interrupts in the PCI subsystem
For now, we only are able to enable or disable pin based interrupts.
Later, when implemented, we could utilize MSI & MSI-X interrupts.
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/PCI/DeviceController.cpp | 43 | ||||
-rw-r--r-- | Kernel/PCI/DeviceController.h | 11 |
2 files changed, 54 insertions, 0 deletions
diff --git a/Kernel/PCI/DeviceController.cpp b/Kernel/PCI/DeviceController.cpp index becf87c944..ea9455e75c 100644 --- a/Kernel/PCI/DeviceController.cpp +++ b/Kernel/PCI/DeviceController.cpp @@ -34,5 +34,48 @@ DeviceController::DeviceController(Address address) { } +bool DeviceController::is_msi_capable() const +{ + for (auto capability : PCI::get_physical_id(pci_address()).capabilities()) { + if (capability.m_id == 0x5) + return true; + } + return false; +} +bool DeviceController::is_msix_capable() const +{ + for (auto capability : PCI::get_physical_id(pci_address()).capabilities()) { + if (capability.m_id == 0x11) + return true; + } + return false; +} + +void DeviceController::enable_pin_based_interrupts() const +{ + PCI::enable_interrupt_line(pci_address()); +} +void DeviceController::disable_pin_based_interrupts() const +{ + PCI::disable_interrupt_line(pci_address()); +} + +void DeviceController::enable_message_signalled_interrupts() +{ + TODO(); +} +void DeviceController::disable_message_signalled_interrupts() +{ + TODO(); +} +void DeviceController::enable_extended_message_signalled_interrupts() +{ + TODO(); +} +void DeviceController::disable_extended_message_signalled_interrupts() +{ + TODO(); +} + } } diff --git a/Kernel/PCI/DeviceController.h b/Kernel/PCI/DeviceController.h index bd42d6c1ec..39935bc9a9 100644 --- a/Kernel/PCI/DeviceController.h +++ b/Kernel/PCI/DeviceController.h @@ -35,6 +35,17 @@ public: Address pci_address() const { return m_pci_address; }; virtual ~DeviceController() { } + void enable_pin_based_interrupts() const; + void disable_pin_based_interrupts() const; + + bool is_msi_capable() const; + bool is_msix_capable() const; + + void enable_message_signalled_interrupts(); + void disable_message_signalled_interrupts(); + + void enable_extended_message_signalled_interrupts(); + void disable_extended_message_signalled_interrupts(); protected: explicit DeviceController(Address pci_address); |