mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:07:47 +00:00
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.
This commit is contained in:
parent
97b36febd5
commit
cf0a12c68f
2 changed files with 54 additions and 0 deletions
|
@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,17 @@ public:
|
||||||
Address pci_address() const { return m_pci_address; };
|
Address pci_address() const { return m_pci_address; };
|
||||||
|
|
||||||
virtual ~DeviceController() { }
|
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:
|
protected:
|
||||||
explicit DeviceController(Address pci_address);
|
explicit DeviceController(Address pci_address);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue