linux内核中断-数据结构-关系图解

来源:互联网 发布:ipo 净利润 数据 编辑:程序博客网 时间:2024/05/21 10:38

linux内核中断-数据结构-关系图解

这里写图片描述

irq_desc

irq_desc结构数组:
每个数组项用来描述一个中断
中断总入口函数asm_do_diq根据中断号调用里面的handle_irq成员

175struct irq_desc {  176        unsigned int            irq;  177        struct timer_rand_state *timer_rand_state;  178        unsigned int            *kstat_irqs;  179#ifdef CONFIG_INTR_REMAP  180        struct irq_2_iommu      *irq_2_iommu;  181#endif  182        irq_flow_handler_t      handle_irq;  183        struct irq_chip         *chip;  184        struct msi_desc         *msi_desc;  185        void                    *handler_data;  186        void                    *chip_data;  187        struct irqaction        *action;        /* IRQ action list */  188        unsigned int            status;         /* IRQ status */  189  190        unsigned int            depth;          /* nested irq disables */  191        unsigned int            wake_depth;     /* nested wake enables */  192        unsigned int            irq_count;      /* For detecting broken IRQs */  193        unsigned long           last_unhandled; /* Aging timer for unhandled count */  194        unsigned int            irqs_unhandled;  195        raw_spinlock_t          lock;  196#ifdef CONFIG_SMP  197        cpumask_var_t           affinity;  198        const struct cpumask    *affinity_hint;  199        unsigned int            node;  200#ifdef CONFIG_GENERIC_PENDING_IRQ  201        cpumask_var_t           pending_mask;  202#endif  203#endif  204        atomic_t                threads_active;  205        wait_queue_head_t       wait_for_threads;  206#ifdef CONFIG_PROC_FS  207        struct proc_dir_entry   *dir;  208#endif  209        const char              *name;  210} ____cacheline_internodealigned_in_smp;  211  212extern void arch_init_copy_chip_data(struct irq_desc *old_desc,  213                                        struct irq_desc *desc, int node);  214extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc);  215  216#ifndef CONFIG_SPARSE_IRQ  217extern struct irq_desc irq_desc[NR_IRQS];  

irq_chip

111struct irq_chip {  112        const char      *name;  113        unsigned int    (*startup)(unsigned int irq);  114        void            (*shutdown)(unsigned int irq);  115        void            (*enable)(unsigned int irq);  116        void            (*disable)(unsigned int irq);  117  118        void            (*ack)(unsigned int irq);  119        void            (*mask)(unsigned int irq);  120        void            (*mask_ack)(unsigned int irq);  121        void            (*unmask)(unsigned int irq);  122        void            (*eoi)(unsigned int irq);  123  124        void            (*end)(unsigned int irq);  125        int             (*set_affinity)(unsigned int irq,  126                                        const struct cpumask *dest);  127        int             (*retrigger)(unsigned int irq);  128        int             (*set_type)(unsigned int irq, unsigned int flow_type);  129        int             (*set_wake)(unsigned int irq, unsigned int on);  130  131        void            (*bus_lock)(unsigned int irq);  132        void            (*bus_sync_unlock)(unsigned int irq);  133  134        /* Currently used only by UML, might disappear one day.*/  135#ifdef CONFIG_IRQ_RELEASE_METHOD  136        void            (*release)(unsigned int irq, void *dev_id);  137#endif  138        /* 139         * For compatibility, ->typename is copied into ->name. 140         * Will disappear. 141         */  142        const char      *typename;  143};  144  

irqaction

113struct irqaction {  114        irq_handler_t handler;  115        unsigned long flags;  116        const char *name;  117        void *dev_id;  118        struct irqaction *next;  119        int irq;  120        struct proc_dir_entry *dir;  121        irq_handler_t thread_fn;  122        struct task_struct *thread;  123        unsigned long thread_flags;  124};  125