| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | 
|---|
| 2 | #ifndef _ASM_X86_HW_IRQ_H | 
|---|
| 3 | #define _ASM_X86_HW_IRQ_H | 
|---|
| 4 |  | 
|---|
| 5 | /* | 
|---|
| 6 | * (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar | 
|---|
| 7 | * | 
|---|
| 8 | * moved some of the old arch/i386/kernel/irq.h to here. VY | 
|---|
| 9 | * | 
|---|
| 10 | * IRQ/IPI changes taken from work by Thomas Radke | 
|---|
| 11 | * <tomsoft@informatik.tu-chemnitz.de> | 
|---|
| 12 | * | 
|---|
| 13 | * hacked by Andi Kleen for x86-64. | 
|---|
| 14 | * unified by tglx | 
|---|
| 15 | */ | 
|---|
| 16 |  | 
|---|
| 17 | #include <asm/irq_vectors.h> | 
|---|
| 18 |  | 
|---|
| 19 | #ifndef __ASSEMBLER__ | 
|---|
| 20 |  | 
|---|
| 21 | #include <linux/percpu.h> | 
|---|
| 22 | #include <linux/profile.h> | 
|---|
| 23 | #include <linux/smp.h> | 
|---|
| 24 |  | 
|---|
| 25 | #include <linux/atomic.h> | 
|---|
| 26 | #include <asm/irq.h> | 
|---|
| 27 | #include <asm/sections.h> | 
|---|
| 28 |  | 
|---|
| 29 | #ifdef	CONFIG_IRQ_DOMAIN_HIERARCHY | 
|---|
| 30 | struct irq_data; | 
|---|
| 31 | struct pci_dev; | 
|---|
| 32 | struct msi_desc; | 
|---|
| 33 |  | 
|---|
| 34 | enum irq_alloc_type { | 
|---|
| 35 | X86_IRQ_ALLOC_TYPE_IOAPIC = 1, | 
|---|
| 36 | X86_IRQ_ALLOC_TYPE_HPET, | 
|---|
| 37 | X86_IRQ_ALLOC_TYPE_PCI_MSI, | 
|---|
| 38 | X86_IRQ_ALLOC_TYPE_PCI_MSIX, | 
|---|
| 39 | X86_IRQ_ALLOC_TYPE_DMAR, | 
|---|
| 40 | X86_IRQ_ALLOC_TYPE_AMDVI, | 
|---|
| 41 | X86_IRQ_ALLOC_TYPE_UV, | 
|---|
| 42 | }; | 
|---|
| 43 |  | 
|---|
| 44 | struct ioapic_alloc_info { | 
|---|
| 45 | int		pin; | 
|---|
| 46 | int		node; | 
|---|
| 47 | u32		is_level	: 1; | 
|---|
| 48 | u32		active_low	: 1; | 
|---|
| 49 | u32		valid		: 1; | 
|---|
| 50 | }; | 
|---|
| 51 |  | 
|---|
| 52 | struct uv_alloc_info { | 
|---|
| 53 | int		limit; | 
|---|
| 54 | int		blade; | 
|---|
| 55 | unsigned long	offset; | 
|---|
| 56 | char		*name; | 
|---|
| 57 |  | 
|---|
| 58 | }; | 
|---|
| 59 |  | 
|---|
| 60 | /** | 
|---|
| 61 | * irq_alloc_info - X86 specific interrupt allocation info | 
|---|
| 62 | * @type:	X86 specific allocation type | 
|---|
| 63 | * @flags:	Flags for allocation tweaks | 
|---|
| 64 | * @devid:	Device ID for allocations | 
|---|
| 65 | * @hwirq:	Associated hw interrupt number in the domain | 
|---|
| 66 | * @mask:	CPU mask for vector allocation | 
|---|
| 67 | * @desc:	Pointer to msi descriptor | 
|---|
| 68 | * @data:	Allocation specific data | 
|---|
| 69 | * | 
|---|
| 70 | * @ioapic:	IOAPIC specific allocation data | 
|---|
| 71 | * @uv:		UV specific allocation data | 
|---|
| 72 | */ | 
|---|
| 73 | struct irq_alloc_info { | 
|---|
| 74 | enum irq_alloc_type	type; | 
|---|
| 75 | u32			flags; | 
|---|
| 76 | u32			devid; | 
|---|
| 77 | irq_hw_number_t		hwirq; | 
|---|
| 78 | const struct cpumask	*mask; | 
|---|
| 79 | struct msi_desc		*desc; | 
|---|
| 80 | void			*data; | 
|---|
| 81 |  | 
|---|
| 82 | union { | 
|---|
| 83 | struct ioapic_alloc_info	ioapic; | 
|---|
| 84 | struct uv_alloc_info		uv; | 
|---|
| 85 | }; | 
|---|
| 86 | }; | 
|---|
| 87 |  | 
|---|
| 88 | struct irq_cfg { | 
|---|
| 89 | unsigned int		dest_apicid; | 
|---|
| 90 | unsigned int		vector; | 
|---|
| 91 | }; | 
|---|
| 92 |  | 
|---|
| 93 | extern struct irq_cfg *irq_cfg(unsigned int irq); | 
|---|
| 94 | extern struct irq_cfg *irqd_cfg(struct irq_data *irq_data); | 
|---|
| 95 | #ifdef CONFIG_SMP | 
|---|
| 96 | extern void vector_schedule_cleanup(struct irq_cfg *); | 
|---|
| 97 | extern void irq_complete_move(struct irq_cfg *cfg); | 
|---|
| 98 | #else | 
|---|
| 99 | static inline void vector_schedule_cleanup(struct irq_cfg *c) { } | 
|---|
| 100 | static inline void irq_complete_move(struct irq_cfg *c) { } | 
|---|
| 101 | #endif | 
|---|
| 102 | extern void apic_ack_edge(struct irq_data *data); | 
|---|
| 103 | #endif /* CONFIG_IRQ_DOMAIN_HIERARCHY */ | 
|---|
| 104 |  | 
|---|
| 105 | #ifdef CONFIG_X86_LOCAL_APIC | 
|---|
| 106 | extern void lock_vector_lock(void); | 
|---|
| 107 | extern void unlock_vector_lock(void); | 
|---|
| 108 | #else | 
|---|
| 109 | static inline void lock_vector_lock(void) {} | 
|---|
| 110 | static inline void unlock_vector_lock(void) {} | 
|---|
| 111 | #endif | 
|---|
| 112 |  | 
|---|
| 113 | /* Statistics */ | 
|---|
| 114 | extern atomic_t irq_err_count; | 
|---|
| 115 | extern atomic_t irq_mis_count; | 
|---|
| 116 |  | 
|---|
| 117 | extern void elcr_set_level_irq(unsigned int irq); | 
|---|
| 118 |  | 
|---|
| 119 | extern char irq_entries_start[]; | 
|---|
| 120 | #ifdef CONFIG_TRACING | 
|---|
| 121 | #define trace_irq_entries_start irq_entries_start | 
|---|
| 122 | #endif | 
|---|
| 123 |  | 
|---|
| 124 | extern char spurious_entries_start[]; | 
|---|
| 125 |  | 
|---|
| 126 | #define VECTOR_UNUSED		NULL | 
|---|
| 127 | #define VECTOR_SHUTDOWN		((void *)-1L) | 
|---|
| 128 | #define VECTOR_RETRIGGERED	((void *)-2L) | 
|---|
| 129 |  | 
|---|
| 130 | typedef struct irq_desc* vector_irq_t[NR_VECTORS]; | 
|---|
| 131 | DECLARE_PER_CPU(vector_irq_t, vector_irq); | 
|---|
| 132 |  | 
|---|
| 133 | #endif /* !__ASSEMBLER__ */ | 
|---|
| 134 |  | 
|---|
| 135 | #endif /* _ASM_X86_HW_IRQ_H */ | 
|---|
| 136 |  | 
|---|