Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_X86_HW_IRQ_H
0003 #define _ASM_X86_HW_IRQ_H
0004 
0005 /*
0006  * (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar
0007  *
0008  * moved some of the old arch/i386/kernel/irq.h to here. VY
0009  *
0010  * IRQ/IPI changes taken from work by Thomas Radke
0011  * <tomsoft@informatik.tu-chemnitz.de>
0012  *
0013  * hacked by Andi Kleen for x86-64.
0014  * unified by tglx
0015  */
0016 
0017 #include <asm/irq_vectors.h>
0018 
0019 #define IRQ_MATRIX_BITS     NR_VECTORS
0020 
0021 #ifndef __ASSEMBLY__
0022 
0023 #include <linux/percpu.h>
0024 #include <linux/profile.h>
0025 #include <linux/smp.h>
0026 
0027 #include <linux/atomic.h>
0028 #include <asm/irq.h>
0029 #include <asm/sections.h>
0030 
0031 #ifdef  CONFIG_X86_LOCAL_APIC
0032 struct irq_data;
0033 struct pci_dev;
0034 struct msi_desc;
0035 
0036 enum irq_alloc_type {
0037     X86_IRQ_ALLOC_TYPE_IOAPIC = 1,
0038     X86_IRQ_ALLOC_TYPE_HPET,
0039     X86_IRQ_ALLOC_TYPE_PCI_MSI,
0040     X86_IRQ_ALLOC_TYPE_PCI_MSIX,
0041     X86_IRQ_ALLOC_TYPE_DMAR,
0042     X86_IRQ_ALLOC_TYPE_AMDVI,
0043     X86_IRQ_ALLOC_TYPE_UV,
0044 };
0045 
0046 struct ioapic_alloc_info {
0047     int     pin;
0048     int     node;
0049     u32     is_level    : 1;
0050     u32     active_low  : 1;
0051     u32     valid       : 1;
0052 };
0053 
0054 struct uv_alloc_info {
0055     int     limit;
0056     int     blade;
0057     unsigned long   offset;
0058     char        *name;
0059 
0060 };
0061 
0062 /**
0063  * irq_alloc_info - X86 specific interrupt allocation info
0064  * @type:   X86 specific allocation type
0065  * @flags:  Flags for allocation tweaks
0066  * @devid:  Device ID for allocations
0067  * @hwirq:  Associated hw interrupt number in the domain
0068  * @mask:   CPU mask for vector allocation
0069  * @desc:   Pointer to msi descriptor
0070  * @data:   Allocation specific data
0071  *
0072  * @ioapic: IOAPIC specific allocation data
0073  * @uv:     UV specific allocation data
0074 */
0075 struct irq_alloc_info {
0076     enum irq_alloc_type type;
0077     u32         flags;
0078     u32         devid;
0079     irq_hw_number_t     hwirq;
0080     const struct cpumask    *mask;
0081     struct msi_desc     *desc;
0082     void            *data;
0083 
0084     union {
0085         struct ioapic_alloc_info    ioapic;
0086         struct uv_alloc_info        uv;
0087     };
0088 };
0089 
0090 struct irq_cfg {
0091     unsigned int        dest_apicid;
0092     unsigned int        vector;
0093 };
0094 
0095 extern struct irq_cfg *irq_cfg(unsigned int irq);
0096 extern struct irq_cfg *irqd_cfg(struct irq_data *irq_data);
0097 extern void lock_vector_lock(void);
0098 extern void unlock_vector_lock(void);
0099 #ifdef CONFIG_SMP
0100 extern void send_cleanup_vector(struct irq_cfg *);
0101 extern void irq_complete_move(struct irq_cfg *cfg);
0102 #else
0103 static inline void send_cleanup_vector(struct irq_cfg *c) { }
0104 static inline void irq_complete_move(struct irq_cfg *c) { }
0105 #endif
0106 
0107 extern void apic_ack_edge(struct irq_data *data);
0108 #else   /*  CONFIG_X86_LOCAL_APIC */
0109 static inline void lock_vector_lock(void) {}
0110 static inline void unlock_vector_lock(void) {}
0111 #endif  /* CONFIG_X86_LOCAL_APIC */
0112 
0113 /* Statistics */
0114 extern atomic_t irq_err_count;
0115 extern atomic_t irq_mis_count;
0116 
0117 extern void elcr_set_level_irq(unsigned int irq);
0118 
0119 extern char irq_entries_start[];
0120 #ifdef CONFIG_TRACING
0121 #define trace_irq_entries_start irq_entries_start
0122 #endif
0123 
0124 extern char spurious_entries_start[];
0125 
0126 #define VECTOR_UNUSED       NULL
0127 #define VECTOR_SHUTDOWN     ((void *)-1L)
0128 #define VECTOR_RETRIGGERED  ((void *)-2L)
0129 
0130 typedef struct irq_desc* vector_irq_t[NR_VECTORS];
0131 DECLARE_PER_CPU(vector_irq_t, vector_irq);
0132 
0133 #endif /* !ASSEMBLY_ */
0134 
0135 #endif /* _ASM_X86_HW_IRQ_H */