2 * Copyright 2010, Clemens Zeidler, haiku@clemens-zeidler.de.
3 * Distributed under the terms of the MIT License.
5 #ifndef IRQ_ROUTING_TABLE_H
6 #define IRQ_ROUTING_TABLE_H
12 #include "util/Vector.h"
15 struct irq_routing_entry
{
17 uint64 device_address
;
22 bool needs_configuration
;
24 // PCI bus_manager connection
27 uint32 pci_function_mask
;
29 // Distilled configuration info
30 uint8 irq
; // Global System Interrupt (GSI)
31 uint8 bios_irq
; // BIOS assigned original IRQ
32 uint8 polarity
; // B_{HIGH|LOW}_ACTIVE_POLARITY
33 uint8 trigger_mode
; // B_{LEVEL|EDGE}_TRIGGERED
37 typedef Vector
<irq_routing_entry
> IRQRoutingTable
;
40 struct irq_descriptor
{
45 // B_LOW_ACTIVE_POLARITY or B_HIGH_ACTIVE_POLARITY
47 // B_LEVEL_TRIGGERED or B_EDGE_TRIGGERED
52 typedef Vector
<irq_descriptor
> irq_descriptor_list
;
65 irq_descriptor current_irq
;
66 Vector
<irq_descriptor
> possible_irqs
;
67 Vector
<irq_routing_entry
*> used_by
;
71 typedef bool (*interrupt_available_check_function
)(int32 globalSystemInterrupt
);
74 void print_irq_descriptor(const irq_descriptor
& descriptor
);
75 void print_irq_routing_table(const IRQRoutingTable
& table
);
78 status_t
prepare_irq_routing(acpi_module_info
* acpi
, IRQRoutingTable
& table
,
79 interrupt_available_check_function checkFunction
);
80 status_t
enable_irq_routing(acpi_module_info
* acpi
,
81 IRQRoutingTable
& routingTable
);
83 status_t
read_current_irq(acpi_module_info
* acpi
, acpi_handle device
,
84 irq_descriptor
& descriptor
);
85 status_t
read_possible_irqs(acpi_module_info
* acpi
, acpi_handle device
,
86 irq_descriptor_list
& descriptorList
);
88 status_t
set_current_irq(acpi_module_info
* acpi
, acpi_handle device
,
89 const irq_descriptor
& descriptor
);
91 #endif // IRQ_ROUTING_TABLE_H