fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / include / linux / irq.h
index fbf6d90..52fc405 100644 (file)
 
 #include <asm/irq.h>
 #include <asm/ptrace.h>
+#include <asm/irq_regs.h>
+
+struct irq_desc;
+typedef        void fastcall (*irq_flow_handler_t)(unsigned int irq,
+                                           struct irq_desc *desc);
+
 
 /*
  * IRQ line status.
@@ -59,6 +65,7 @@
 #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 */
+#define IRQ_MOVE_PENDING       0x40000000      /* need to re-target IRQ destination */
 
 struct proc_dir_entry;
 
@@ -132,16 +139,14 @@ struct irq_chip {
  * @affinity:          IRQ affinity on SMP
  * @cpu:               cpu index useful for balancing
  * @pending_mask:      pending rebalanced interrupts
- * @move_irq:          need to re-target IRQ destination
  * @dir:               /proc/irq/ procfs entry
  * @affinity_entry:    /proc/irq/smp_affinity procfs entry on SMP
+ * @name:              flow handler name for /proc/interrupts output
  *
  * Pad this out to 32 bytes for cache and indexing reasons.
  */
 struct irq_desc {
-       void fastcall           (*handle_irq)(unsigned int irq,
-                                             struct irq_desc *desc,
-                                             struct pt_regs *regs);
+       irq_flow_handler_t      handle_irq;
        struct irq_chip         *chip;
        void                    *handler_data;
        void                    *chip_data;
@@ -159,11 +164,11 @@ struct irq_desc {
 #endif
 #if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE)
        cpumask_t               pending_mask;
-       unsigned int            move_irq;       /* need to re-target IRQ dest */
 #endif
 #ifdef CONFIG_PROC_FS
-       struct proc_dir_entry *dir;
+       struct proc_dir_entry   *dir;
 #endif
+       const char              *name;
 } ____cacheline_aligned;
 
 extern struct irq_desc irq_desc[NR_IRQS];
@@ -206,36 +211,7 @@ static inline void set_native_irq_info(int irq, cpumask_t mask)
 
 void set_pending_irq(unsigned int irq, cpumask_t mask);
 void move_native_irq(int irq);
-
-#ifdef CONFIG_PCI_MSI
-/*
- * Wonder why these are dummies?
- * For e.g the set_ioapic_affinity_vector() calls the set_ioapic_affinity_irq()
- * counter part after translating the vector to irq info. We need to perform
- * this operation on the real irq, when we dont use vector, i.e when
- * pci_use_vector() is false.
- */
-static inline void move_irq(int irq)
-{
-}
-
-static inline void set_irq_info(int irq, cpumask_t mask)
-{
-}
-
-#else /* CONFIG_PCI_MSI */
-
-static inline void move_irq(int irq)
-{
-       move_native_irq(irq);
-}
-
-static inline void set_irq_info(int irq, cpumask_t mask)
-{
-       set_native_irq_info(irq, mask);
-}
-
-#endif /* CONFIG_PCI_MSI */
+void move_masked_irq(int irq);
 
 #else /* CONFIG_GENERIC_PENDING_IRQ || CONFIG_IRQBALANCE */
 
@@ -247,21 +223,20 @@ static inline void move_native_irq(int irq)
 {
 }
 
-static inline void set_pending_irq(unsigned int irq, cpumask_t mask)
+static inline void move_masked_irq(int irq)
 {
 }
 
-static inline void set_irq_info(int irq, cpumask_t mask)
+static inline void set_pending_irq(unsigned int irq, cpumask_t mask)
 {
-       set_native_irq_info(irq, mask);
 }
 
 #endif /* CONFIG_GENERIC_PENDING_IRQ */
 
 #else /* CONFIG_SMP */
 
-#define move_irq(x)
 #define move_native_irq(x)
+#define move_masked_irq(x)
 
 #endif /* CONFIG_SMP */
 
@@ -285,42 +260,26 @@ static inline int select_smp_affinity(unsigned int irq)
 extern int no_irq_affinity;
 
 /* Handle irq action chains: */
-extern int handle_IRQ_event(unsigned int irq, struct pt_regs *regs,
-                           struct irqaction *action);
+extern int handle_IRQ_event(unsigned int irq, struct irqaction *action);
 
 /*
  * Built-in IRQ handlers for various IRQ types,
  * callable via desc->chip->handle_irq()
  */
-extern void fastcall
-handle_level_irq(unsigned int irq, struct irq_desc *desc, struct pt_regs *regs);
-extern void fastcall
-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);
-extern void fastcall
-handle_simple_irq(unsigned int irq, struct irq_desc *desc,
-                 struct pt_regs *regs);
-extern void fastcall
-handle_percpu_irq(unsigned int irq, struct irq_desc *desc,
-                 struct pt_regs *regs);
-extern void fastcall
-handle_bad_irq(unsigned int irq, struct irq_desc *desc, struct pt_regs *regs);
-
-/*
- * Get a descriptive string for the highlevel handler, for
- * /proc/interrupts output:
- */
-extern const char *
-handle_irq_name(void fastcall (*handle)(unsigned int, struct irq_desc *,
-                                       struct pt_regs *));
+extern void fastcall handle_level_irq(unsigned int irq, struct irq_desc *desc);
+extern void fastcall handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc);
+extern void fastcall handle_edge_irq(unsigned int irq, struct irq_desc *desc);
+extern void fastcall handle_simple_irq(unsigned int irq, struct irq_desc *desc);
+extern void fastcall handle_percpu_irq(unsigned int irq, struct irq_desc *desc);
+extern void fastcall handle_bad_irq(unsigned int irq, struct irq_desc *desc);
 
 /*
  * Monolithic do_IRQ implementation.
  * (is an explicit fastcall, because i386 4KSTACKS calls it from assembly)
  */
-extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
+#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
+extern fastcall unsigned int __do_IRQ(unsigned int irq);
+#endif
 
 /*
  * Architectures call this to let the generic IRQ layer
@@ -328,19 +287,23 @@ extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
  * irqchip-style controller then we call the ->handle_irq() handler,
  * and it calls __do_IRQ() if it's attached to an irqtype-style controller.
  */
-static inline void generic_handle_irq(unsigned int irq, struct pt_regs *regs)
+static inline void generic_handle_irq(unsigned int irq)
 {
        struct irq_desc *desc = irq_desc + irq;
 
+#ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
+       desc->handle_irq(irq, desc);
+#else
        if (likely(desc->handle_irq))
-               desc->handle_irq(irq, desc, regs);
+               desc->handle_irq(irq, desc);
        else
-               __do_IRQ(irq, regs);
+               __do_IRQ(irq);
+#endif
 }
 
 /* Handling of unhandled and spurious interrupts: */
 extern void note_interrupt(unsigned int irq, struct irq_desc *desc,
-                          int action_ret, struct pt_regs *regs);
+                          int action_ret);
 
 /* Resending of interrupts :*/
 void check_irq_resend(struct irq_desc *desc, unsigned int irq);
@@ -360,24 +323,22 @@ extern struct irq_chip dummy_irq_chip;
 
 extern void
 set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip,
-                        void fastcall (*handle)(unsigned int,
-                                                struct irq_desc *,
-                                                struct pt_regs *));
+                        irq_flow_handler_t handle);
 extern void
-__set_irq_handler(unsigned int irq,
-                 void fastcall (*handle)(unsigned int, struct irq_desc *,
-                                         struct pt_regs *),
-                 int is_chained);
+set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip,
+                             irq_flow_handler_t handle, const char *name);
+
+extern void
+__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
+                 const char *name);
 
 /*
  * Set a highlevel flow handler for a given IRQ:
  */
 static inline void
-set_irq_handler(unsigned int irq,
-               void fastcall (*handle)(unsigned int, struct irq_desc *,
-                                       struct pt_regs *))
+set_irq_handler(unsigned int irq, irq_flow_handler_t handle)
 {
-       __set_irq_handler(irq, handle, 0);
+       __set_irq_handler(irq, handle, 0, NULL);
 }
 
 /*
@@ -387,14 +348,27 @@ set_irq_handler(unsigned int irq,
  */
 static inline void
 set_irq_chained_handler(unsigned int irq,
-                       void fastcall (*handle)(unsigned int, struct irq_desc *,
-                                               struct pt_regs *))
+                       irq_flow_handler_t handle)
 {
-       __set_irq_handler(irq, handle, 1);
+       __set_irq_handler(irq, handle, 1, NULL);
 }
 
-/* Set/get chip/data for an IRQ: */
+/* Handle dynamic irq creation and destruction */
+extern int create_irq(void);
+extern void destroy_irq(unsigned int irq);
 
+/* Test to see if a driver has successfully requested an irq */
+static inline int irq_has_action(unsigned int irq)
+{
+       struct irq_desc *desc = irq_desc + irq;
+       return desc->action != NULL;
+}
+
+/* Dynamic irq helper functions */
+extern void dynamic_irq_init(unsigned int irq);
+extern void dynamic_irq_cleanup(unsigned int irq);
+
+/* 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);