]> err.no Git - linux-2.6/blobdiff - include/linux/irq.h
[PATCH] Debug variants of linked list macros
[linux-2.6] / include / linux / irq.h
index b40771dd114a777841db9be3b1ebc5ecd6119c32..48d3cb3b6a4737d380bdbe21e8be467284640bd1 100644 (file)
 
 /*
  * IRQ line status.
+ *
+ * Bits 0-16 are reserved for the IRQF_* bits in linux/interrupt.h
+ *
+ * IRQ types
  */
-#define IRQ_INPROGRESS 1       /* IRQ handler active - do not enter! */
-#define IRQ_DISABLED   2       /* IRQ disabled - do not enter! */
-#define IRQ_PENDING    4       /* IRQ pending - replay on enable */
-#define IRQ_REPLAY     8       /* IRQ has been replayed but not acked yet */
-#define IRQ_AUTODETECT 16      /* IRQ is being autodetected */
-#define IRQ_WAITING    32      /* IRQ not yet seen - for autodetection */
-#define IRQ_LEVEL      64      /* IRQ level triggered */
-#define IRQ_MASKED     128     /* IRQ masked - shouldn't be seen again */
+#define IRQ_TYPE_NONE          0x00000000      /* Default, unspecified type */
+#define IRQ_TYPE_EDGE_RISING   0x00000001      /* Edge rising type */
+#define IRQ_TYPE_EDGE_FALLING  0x00000002      /* Edge falling type */
+#define IRQ_TYPE_EDGE_BOTH (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)
+#define IRQ_TYPE_LEVEL_HIGH    0x00000004      /* Level high type */
+#define IRQ_TYPE_LEVEL_LOW     0x00000008      /* Level low type */
+#define IRQ_TYPE_SENSE_MASK    0x0000000f      /* Mask of the above */
+#define IRQ_TYPE_PROBE         0x00000010      /* Probing in progress */
+
+/* Internal flags */
+#define IRQ_INPROGRESS         0x00010000      /* IRQ handler active - do not enter! */
+#define IRQ_DISABLED           0x00020000      /* IRQ disabled - do not enter! */
+#define IRQ_PENDING            0x00040000      /* IRQ pending - replay on enable */
+#define IRQ_REPLAY             0x00080000      /* IRQ has been replayed but not acked yet */
+#define IRQ_AUTODETECT         0x00100000      /* IRQ is being autodetected */
+#define IRQ_WAITING            0x00200000      /* IRQ not yet seen - for autodetection */
+#define IRQ_LEVEL              0x00400000      /* IRQ level triggered */
+#define IRQ_MASKED             0x00800000      /* IRQ masked - shouldn't be seen again */
+#define IRQ_PER_CPU            0x01000000      /* IRQ is per CPU */
 #ifdef CONFIG_IRQ_PER_CPU
-# define IRQ_PER_CPU   256     /* IRQ is per CPU */
 # define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
 #else
 # define CHECK_IRQ_PER_CPU(var) 0
 #endif
 
-#define IRQ_NOPROBE    512     /* IRQ is not valid for probing */
-#define IRQ_NOREQUEST  1024    /* IRQ cannot be requested */
-#define IRQ_NOAUTOEN   2048    /* IRQ will not be enabled on request irq */
-#define IRQ_DELAYED_DISABLE \
-                       4096    /* IRQ disable (masking) happens delayed. */
-
-/*
- * IRQ types, see also include/linux/interrupt.h
- */
-#define IRQ_TYPE_NONE          0x0000          /* Default, unspecified type */
-#define IRQ_TYPE_EDGE_RISING   0x0001          /* Edge rising type */
-#define IRQ_TYPE_EDGE_FALLING  0x0002          /* Edge falling type */
-#define IRQ_TYPE_EDGE_BOTH (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)
-#define IRQ_TYPE_LEVEL_HIGH    0x0004          /* Level high type */
-#define IRQ_TYPE_LEVEL_LOW     0x0008          /* Level low type */
-#define IRQ_TYPE_SIMPLE                0x0010          /* Simple type */
-#define IRQ_TYPE_PERCPU                0x0020          /* Per CPU type */
-#define IRQ_TYPE_PROBE         0x0040          /* Probing in progress */
+#define IRQ_NOPROBE            0x02000000      /* IRQ is not valid for probing */
+#define IRQ_NOREQUEST          0x04000000      /* IRQ cannot be requested */
+#define IRQ_NOAUTOEN           0x08000000      /* IRQ will not be enabled on request irq */
+#define IRQ_DELAYED_DISABLE    0x10000000      /* IRQ disable (masking) happens delayed. */
+#define IRQ_WAKEUP             0x20000000      /* IRQ triggers system wakeup */
 
 struct proc_dir_entry;
 
@@ -73,7 +74,8 @@ struct proc_dir_entry;
  * @mask:              mask an interrupt source
  * @mask_ack:          ack and mask an interrupt source
  * @unmask:            unmask an interrupt source
- * @end:               end of interrupt
+ * @eoi:               end of interrupt - chip level
+ * @end:               end of interrupt - flow level
  * @set_affinity:      set the CPU affinity on SMP machines
  * @retrigger:         resend an IRQ to the CPU
  * @set_type:          set the flow type (IRQ_TYPE_LEVEL/etc.) of an IRQ
@@ -93,6 +95,7 @@ struct irq_chip {
        void            (*mask)(unsigned int irq);
        void            (*mask_ack)(unsigned int irq);
        void            (*unmask)(unsigned int irq);
+       void            (*eoi)(unsigned int irq);
 
        void            (*end)(unsigned int irq);
        void            (*set_affinity)(unsigned int irq, cpumask_t dest);
@@ -122,6 +125,7 @@ struct irq_chip {
  * @action:            the irq action chain
  * @status:            status information
  * @depth:             disable-depth, for nested irq_disable() calls
+ * @wake_depth:                enable depth, for multiple set_irq_wake() callers
  * @irq_count:         stats field to detect stalled irqs
  * @irqs_unhandled:    stats field for spurious unhandled interrupts
  * @lock:              locking for SMP
@@ -145,6 +149,7 @@ struct irq_desc {
        unsigned int            status;         /* IRQ status */
 
        unsigned int            depth;          /* nested irq disables */
+       unsigned int            wake_depth;     /* nested wake enables */
        unsigned int            irq_count;      /* For detecting broken IRQs */
        unsigned int            irqs_unhandled;
        spinlock_t              lock;
@@ -180,6 +185,10 @@ extern int setup_irq(unsigned int irq, struct irqaction *new);
 
 #ifdef CONFIG_GENERIC_HARDIRQS
 
+#ifndef handle_dynamic_tick
+# define handle_dynamic_tick(a)                do { } while (0)
+#endif
+
 #ifdef CONFIG_SMP
 static inline void set_native_irq_info(int irq, cpumask_t mask)
 {
@@ -286,7 +295,7 @@ extern int handle_IRQ_event(unsigned int irq, struct pt_regs *regs,
 extern void fastcall
 handle_level_irq(unsigned int irq, struct irq_desc *desc, struct pt_regs *regs);
 extern void fastcall
-handle_fastack_irq(unsigned int irq, struct irq_desc *desc,
+handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc,
                         struct pt_regs *regs);
 extern void fastcall
 handle_edge_irq(unsigned int irq, struct irq_desc *desc, struct pt_regs *regs);
@@ -311,7 +320,9 @@ handle_irq_name(void fastcall (*handle)(unsigned int, struct irq_desc *,
  * Monolithic do_IRQ implementation.
  * (is an explicit fastcall, because i386 4KSTACKS calls it from assembly)
  */
+#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
 extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
+#endif
 
 /*
  * Architectures call this to let the generic IRQ layer
@@ -323,10 +334,14 @@ static inline void generic_handle_irq(unsigned int irq, struct pt_regs *regs)
 {
        struct irq_desc *desc = irq_desc + irq;
 
+#ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
+       desc->handle_irq(irq, desc, regs);
+#else
        if (likely(desc->handle_irq))
                desc->handle_irq(irq, desc, regs);
        else
                __do_IRQ(irq, regs);
+#endif
 }
 
 /* Handling of unhandled and spurious interrupts: */
@@ -345,8 +360,9 @@ extern int noirqdebug_setup(char *str);
 /* Checks whether the interrupt can be requested by request_irq(): */
 extern int can_request_irq(unsigned int irq, unsigned long irqflags);
 
-/* Dummy irq-chip implementation: */
+/* Dummy irq-chip implementations: */
 extern struct irq_chip no_irq_chip;
+extern struct irq_chip dummy_irq_chip;
 
 extern void
 set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip,
@@ -383,6 +399,17 @@ set_irq_chained_handler(unsigned int irq,
        __set_irq_handler(irq, handle, 1);
 }
 
+/* Set/get chip/data for an IRQ: */
+
+extern int set_irq_chip(unsigned int irq, struct irq_chip *chip);
+extern int set_irq_data(unsigned int irq, void *data);
+extern int set_irq_chip_data(unsigned int irq, void *data);
+extern int set_irq_type(unsigned int irq, unsigned int type);
+
+#define get_irq_chip(irq)      (irq_desc[irq].chip)
+#define get_irq_chip_data(irq) (irq_desc[irq].chip_data)
+#define get_irq_data(irq)      (irq_desc[irq].handler_data)
+
 #endif /* CONFIG_GENERIC_HARDIRQS */
 
 #endif /* !CONFIG_S390 */