diff options
author | Liav A <liavalb@gmail.com> | 2021-09-23 10:50:45 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-29 11:24:33 +0200 |
commit | a411a44fda3ba713e139331d4c29ea32f70c99d8 (patch) | |
tree | 8f17520fc4f614a622cd2a30b591db9beff61ae6 /Kernel/Bus/PCI/Definitions.h | |
parent | 057f5a12c2c69b1bad1d8b778d3cb934b3a8f346 (diff) | |
download | serenity-a411a44fda3ba713e139331d4c29ea32f70c99d8.zip |
Kernel/PCI: Cache interrupt line and interrupt pin of a device
This allows us to remove the PCI::get_interrupt_line API function. As a
result, this removes a bunch of not so great patterns that we used to
cache PCI interrupt line in many IRQHandler derived classes instead of
just using interrupt_number method of IRQHandler class.
Diffstat (limited to 'Kernel/Bus/PCI/Definitions.h')
-rw-r--r-- | Kernel/Bus/PCI/Definitions.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Kernel/Bus/PCI/Definitions.h b/Kernel/Bus/PCI/Definitions.h index b2a9831d89..24bfa19a74 100644 --- a/Kernel/Bus/PCI/Definitions.h +++ b/Kernel/Bus/PCI/Definitions.h @@ -36,6 +36,7 @@ namespace Kernel { #define PCI_SUBSYSTEM_ID 0x2E // u16 #define PCI_CAPABILITIES_POINTER 0x34 // u8 #define PCI_INTERRUPT_LINE 0x3C // byte +#define PCI_INTERRUPT_PIN 0x3D // byte #define PCI_SECONDARY_BUS 0x19 // byte #define PCI_HEADER_TYPE_DEVICE 0 #define PCI_HEADER_TYPE_BRIDGE 1 @@ -187,11 +188,13 @@ TYPEDEF_DISTINCT_ORDERED_ID(u8, ProgrammingInterface); TYPEDEF_DISTINCT_ORDERED_ID(u8, RevisionID); TYPEDEF_DISTINCT_ORDERED_ID(u16, SubsystemID); TYPEDEF_DISTINCT_ORDERED_ID(u16, SubsystemVendorID); +TYPEDEF_DISTINCT_ORDERED_ID(u8, InterruptLine); +TYPEDEF_DISTINCT_ORDERED_ID(u8, InterruptPin); class Access; class DeviceIdentifier { public: - DeviceIdentifier(Address address, HardwareID hardware_id, RevisionID revision_id, ClassCode class_code, SubclassCode subclass_code, ProgrammingInterface prog_if, SubsystemID subsystem_id, SubsystemVendorID subsystem_vendor_id, Vector<Capability> capabilities) + DeviceIdentifier(Address address, HardwareID hardware_id, RevisionID revision_id, ClassCode class_code, SubclassCode subclass_code, ProgrammingInterface prog_if, SubsystemID subsystem_id, SubsystemVendorID subsystem_vendor_id, InterruptLine interrupt_line, InterruptPin interrupt_pin, Vector<Capability> capabilities) : m_address(address) , m_hardware_id(hardware_id) , m_revision_id(revision_id) @@ -200,6 +203,8 @@ public: , m_prog_if(prog_if) , m_subsystem_id(subsystem_id) , m_subsystem_vendor_id(subsystem_vendor_id) + , m_interrupt_line(interrupt_line) + , m_interrupt_pin(interrupt_pin) , m_capabilities(capabilities) { if constexpr (PCI_DEBUG) { @@ -219,6 +224,9 @@ public: SubsystemID subsystem_id() const { return m_subsystem_id; } SubsystemVendorID subsystem_vendor_id() const { return m_subsystem_vendor_id; } + InterruptLine interrupt_line() const { return m_interrupt_line; } + InterruptPin interrupt_pin() const { return m_interrupt_pin; } + void apply_subclass_code_change(Badge<Access>, SubclassCode new_subclass) { m_subclass_code = new_subclass; @@ -239,6 +247,9 @@ private: SubsystemID m_subsystem_id; SubsystemVendorID m_subsystem_vendor_id; + InterruptLine m_interrupt_line; + InterruptPin m_interrupt_pin; + Vector<Capability> m_capabilities; }; |