headers/bsd: Add sys/queue.h.
[haiku.git] / src / system / kernel / arch / x86 / irq_routing_table.h
blob41a2bb6d507741080a6c033c6a0e28ef66e7f7f7
1 /*
2 * Copyright 2010, Clemens Zeidler, haiku@clemens-zeidler.de.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef IRQ_ROUTING_TABLE_H
6 #define IRQ_ROUTING_TABLE_H
9 #include <ACPI.h>
12 #include "util/Vector.h"
15 struct irq_routing_entry {
16 // ACPI specifics
17 uint64 device_address;
18 uint8 pin;
20 acpi_handle source;
21 uint32 source_index;
22 bool needs_configuration;
24 // PCI bus_manager connection
25 uint8 pci_bus;
26 uint8 pci_device;
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 {
41 irq_descriptor();
43 uint8 irq;
44 bool shareable;
45 // B_LOW_ACTIVE_POLARITY or B_HIGH_ACTIVE_POLARITY
46 uint8 polarity;
47 // B_LEVEL_TRIGGERED or B_EDGE_TRIGGERED
48 uint8 trigger_mode;
52 typedef Vector<irq_descriptor> irq_descriptor_list;
55 struct pci_address {
56 uint8 segment;
57 uint8 bus;
58 uint8 device;
59 uint8 function;
63 struct link_device {
64 acpi_handle handle;
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