aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/irq.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/irq.h')
-rw-r--r--include/linux/irq.h65
1 files changed, 53 insertions, 12 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 03f48d936f66..d09ec7a1243e 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -15,11 +15,13 @@
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16#include <linux/cpumask.h> 16#include <linux/cpumask.h>
17#include <linux/gfp.h> 17#include <linux/gfp.h>
18#include <linux/irqhandler.h>
18#include <linux/irqreturn.h> 19#include <linux/irqreturn.h>
19#include <linux/irqnr.h> 20#include <linux/irqnr.h>
20#include <linux/errno.h> 21#include <linux/errno.h>
21#include <linux/topology.h> 22#include <linux/topology.h>
22#include <linux/wait.h> 23#include <linux/wait.h>
24#include <linux/io.h>
23 25
24#include <asm/irq.h> 26#include <asm/irq.h>
25#include <asm/ptrace.h> 27#include <asm/ptrace.h>
@@ -27,11 +29,7 @@
27 29
28struct seq_file; 30struct seq_file;
29struct module; 31struct module;
30struct irq_desc; 32struct msi_msg;
31struct irq_data;
32typedef void (*irq_flow_handler_t)(unsigned int irq,
33 struct irq_desc *desc);
34typedef void (*irq_preflow_handler_t)(struct irq_data *data);
35 33
36/* 34/*
37 * IRQ line status. 35 * IRQ line status.
@@ -113,10 +111,14 @@ enum {
113 * 111 *
114 * IRQ_SET_MASK_OK - OK, core updates irq_data.affinity 112 * IRQ_SET_MASK_OK - OK, core updates irq_data.affinity
115 * IRQ_SET_MASK_NOCPY - OK, chip did update irq_data.affinity 113 * IRQ_SET_MASK_NOCPY - OK, chip did update irq_data.affinity
114 * IRQ_SET_MASK_OK_DONE - Same as IRQ_SET_MASK_OK for core. Special code to
115 * support stacked irqchips, which indicates skipping
116 * all descendent irqchips.
116 */ 117 */
117enum { 118enum {
118 IRQ_SET_MASK_OK = 0, 119 IRQ_SET_MASK_OK = 0,
119 IRQ_SET_MASK_OK_NOCOPY, 120 IRQ_SET_MASK_OK_NOCOPY,
121 IRQ_SET_MASK_OK_DONE,
120}; 122};
121 123
122struct msi_desc; 124struct msi_desc;
@@ -133,6 +135,8 @@ struct irq_domain;
133 * @chip: low level interrupt hardware access 135 * @chip: low level interrupt hardware access
134 * @domain: Interrupt translation domain; responsible for mapping 136 * @domain: Interrupt translation domain; responsible for mapping
135 * between hwirq number and linux irq number. 137 * between hwirq number and linux irq number.
138 * @parent_data: pointer to parent struct irq_data to support hierarchy
139 * irq_domain
136 * @handler_data: per-IRQ data for the irq_chip methods 140 * @handler_data: per-IRQ data for the irq_chip methods
137 * @chip_data: platform-specific per-chip private data for the chip 141 * @chip_data: platform-specific per-chip private data for the chip
138 * methods, to allow shared chip implementations 142 * methods, to allow shared chip implementations
@@ -151,6 +155,9 @@ struct irq_data {
151 unsigned int state_use_accessors; 155 unsigned int state_use_accessors;
152 struct irq_chip *chip; 156 struct irq_chip *chip;
153 struct irq_domain *domain; 157 struct irq_domain *domain;
158#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
159 struct irq_data *parent_data;
160#endif
154 void *handler_data; 161 void *handler_data;
155 void *chip_data; 162 void *chip_data;
156 struct msi_desc *msi_desc; 163 struct msi_desc *msi_desc;
@@ -315,6 +322,8 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d)
315 * any other callback related to this irq 322 * any other callback related to this irq
316 * @irq_release_resources: optional to release resources acquired with 323 * @irq_release_resources: optional to release resources acquired with
317 * irq_request_resources 324 * irq_request_resources
325 * @irq_compose_msi_msg: optional to compose message content for MSI
326 * @irq_write_msi_msg: optional to write message content for MSI
318 * @flags: chip specific flags 327 * @flags: chip specific flags
319 */ 328 */
320struct irq_chip { 329struct irq_chip {
@@ -351,6 +360,9 @@ struct irq_chip {
351 int (*irq_request_resources)(struct irq_data *data); 360 int (*irq_request_resources)(struct irq_data *data);
352 void (*irq_release_resources)(struct irq_data *data); 361 void (*irq_release_resources)(struct irq_data *data);
353 362
363 void (*irq_compose_msi_msg)(struct irq_data *data, struct msi_msg *msg);
364 void (*irq_write_msi_msg)(struct irq_data *data, struct msi_msg *msg);
365
354 unsigned long flags; 366 unsigned long flags;
355}; 367};
356 368
@@ -438,6 +450,18 @@ extern void handle_percpu_devid_irq(unsigned int irq, struct irq_desc *desc);
438extern void handle_bad_irq(unsigned int irq, struct irq_desc *desc); 450extern void handle_bad_irq(unsigned int irq, struct irq_desc *desc);
439extern void handle_nested_irq(unsigned int irq); 451extern void handle_nested_irq(unsigned int irq);
440 452
453extern int irq_chip_compose_msi_msg(struct irq_data *data, struct msi_msg *msg);
454#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
455extern void irq_chip_ack_parent(struct irq_data *data);
456extern int irq_chip_retrigger_hierarchy(struct irq_data *data);
457extern void irq_chip_mask_parent(struct irq_data *data);
458extern void irq_chip_unmask_parent(struct irq_data *data);
459extern void irq_chip_eoi_parent(struct irq_data *data);
460extern int irq_chip_set_affinity_parent(struct irq_data *data,
461 const struct cpumask *dest,
462 bool force);
463#endif
464
441/* Handling of unhandled and spurious interrupts: */ 465/* Handling of unhandled and spurious interrupts: */
442extern void note_interrupt(unsigned int irq, struct irq_desc *desc, 466extern void note_interrupt(unsigned int irq, struct irq_desc *desc,
443 irqreturn_t action_ret); 467 irqreturn_t action_ret);
@@ -639,13 +663,6 @@ void arch_teardown_hwirq(unsigned int irq);
639void irq_init_desc(unsigned int irq); 663void irq_init_desc(unsigned int irq);
640#endif 664#endif
641 665
642#ifndef irq_reg_writel
643# define irq_reg_writel(val, addr) writel(val, addr)
644#endif
645#ifndef irq_reg_readl
646# define irq_reg_readl(addr) readl(addr)
647#endif
648
649/** 666/**
650 * struct irq_chip_regs - register offsets for struct irq_gci 667 * struct irq_chip_regs - register offsets for struct irq_gci
651 * @enable: Enable register offset to reg_base 668 * @enable: Enable register offset to reg_base
@@ -692,6 +709,8 @@ struct irq_chip_type {
692 * struct irq_chip_generic - Generic irq chip data structure 709 * struct irq_chip_generic - Generic irq chip data structure
693 * @lock: Lock to protect register and cache data access 710 * @lock: Lock to protect register and cache data access
694 * @reg_base: Register base address (virtual) 711 * @reg_base: Register base address (virtual)
712 * @reg_readl: Alternate I/O accessor (defaults to readl if NULL)
713 * @reg_writel: Alternate I/O accessor (defaults to writel if NULL)
695 * @irq_base: Interrupt base nr for this chip 714 * @irq_base: Interrupt base nr for this chip
696 * @irq_cnt: Number of interrupts handled by this chip 715 * @irq_cnt: Number of interrupts handled by this chip
697 * @mask_cache: Cached mask register shared between all chip types 716 * @mask_cache: Cached mask register shared between all chip types
@@ -716,6 +735,8 @@ struct irq_chip_type {
716struct irq_chip_generic { 735struct irq_chip_generic {
717 raw_spinlock_t lock; 736 raw_spinlock_t lock;
718 void __iomem *reg_base; 737 void __iomem *reg_base;
738 u32 (*reg_readl)(void __iomem *addr);
739 void (*reg_writel)(u32 val, void __iomem *addr);
719 unsigned int irq_base; 740 unsigned int irq_base;
720 unsigned int irq_cnt; 741 unsigned int irq_cnt;
721 u32 mask_cache; 742 u32 mask_cache;
@@ -740,12 +761,14 @@ struct irq_chip_generic {
740 * the parent irq. Usually GPIO implementations 761 * the parent irq. Usually GPIO implementations
741 * @IRQ_GC_MASK_CACHE_PER_TYPE: Mask cache is chip type private 762 * @IRQ_GC_MASK_CACHE_PER_TYPE: Mask cache is chip type private
742 * @IRQ_GC_NO_MASK: Do not calculate irq_data->mask 763 * @IRQ_GC_NO_MASK: Do not calculate irq_data->mask
764 * @IRQ_GC_BE_IO: Use big-endian register accesses (default: LE)
743 */ 765 */
744enum irq_gc_flags { 766enum irq_gc_flags {
745 IRQ_GC_INIT_MASK_CACHE = 1 << 0, 767 IRQ_GC_INIT_MASK_CACHE = 1 << 0,
746 IRQ_GC_INIT_NESTED_LOCK = 1 << 1, 768 IRQ_GC_INIT_NESTED_LOCK = 1 << 1,
747 IRQ_GC_MASK_CACHE_PER_TYPE = 1 << 2, 769 IRQ_GC_MASK_CACHE_PER_TYPE = 1 << 2,
748 IRQ_GC_NO_MASK = 1 << 3, 770 IRQ_GC_NO_MASK = 1 << 3,
771 IRQ_GC_BE_IO = 1 << 4,
749}; 772};
750 773
751/* 774/*
@@ -821,4 +844,22 @@ static inline void irq_gc_lock(struct irq_chip_generic *gc) { }
821static inline void irq_gc_unlock(struct irq_chip_generic *gc) { } 844static inline void irq_gc_unlock(struct irq_chip_generic *gc) { }
822#endif 845#endif
823 846
847static inline void irq_reg_writel(struct irq_chip_generic *gc,
848 u32 val, int reg_offset)
849{
850 if (gc->reg_writel)
851 gc->reg_writel(val, gc->reg_base + reg_offset);
852 else
853 writel(val, gc->reg_base + reg_offset);
854}
855
856static inline u32 irq_reg_readl(struct irq_chip_generic *gc,
857 int reg_offset)
858{
859 if (gc->reg_readl)
860 return gc->reg_readl(gc->reg_base + reg_offset);
861 else
862 return readl(gc->reg_base + reg_offset);
863}
864
824#endif /* _LINUX_IRQ_H */ 865#endif /* _LINUX_IRQ_H */