Linux内核中断之中断请求队列的初始化


Linux内核中断之中断请求队列的初始化:

  1. /* 
  2.  * Core internal functions to deal with irq descriptors 
  3.  * 
  4.  * This include will move to kernel/irq once we cleaned up the tree. 
  5.  * For now it's included from <linux/irq.h> 
  6.  */  
  7.   
  8. struct irq_affinity_notify;  
  9. struct proc_dir_entry;  
  10. struct timer_rand_state;  
  11. /** 
  12.  * struct irq_desc - interrupt descriptor 
  13.  * @irq_data:       per irq and chip data passed down to chip functions 
  14.  * @timer_rand_state:   pointer to timer rand state struct 
  15.  * @kstat_irqs:     irq stats per cpu 
  16.  * @handle_irq:     highlevel irq-events handler 
  17.  * @preflow_handler:    handler called before the flow handler (currently used by sparc) 
  18.  * @action:     the irq action chain 
  19.  * @status:     status information 
  20.  * @core_internal_state__do_not_mess_with_it: core internal status information 
  21.  * @depth:      disable-depth, for nested irq_disable() calls 
  22.  * @wake_depth:     enable depth, for multiple irq_set_irq_wake() callers 
  23.  * @irq_count:      stats field to detect stalled irqs 
  24.  * @last_unhandled: aging timer for unhandled count 
  25.  * @irqs_unhandled: stats field for spurious unhandled interrupts 
  26.  * @lock:       locking for SMP 
  27.  * @affinity_hint:  hint to user space for preferred irq affinity 
  28.  * @affinity_notify:    context for notification of affinity changes 
  29.  * @pending_mask:   pending rebalanced interrupts 
  30.  * @threads_oneshot:    bitfield to handle shared oneshot threads 
  31.  * @threads_active: number of irqaction threads currently running 
  32.  * @wait_for_threads:   wait queue for sync_irq to wait for threaded handlers 
  33.  * @dir:        /proc/irq/ procfs entry 
  34.  * @name:       flow handler name for /proc/interrupts output 
  35.  */  
  36. struct irq_desc {  
  37.     struct irq_data     irq_data;  
  38.     struct timer_rand_state *timer_rand_state;  
  39.     unsigned int __percpu   *kstat_irqs;  
  40.     irq_flow_handler_t  handle_irq;  
  41. #ifdef CONFIG_IRQ_PREFLOW_FASTEOI   
  42.     irq_preflow_handler_t   preflow_handler;  
  43. #endif   
  44.     struct irqaction    *action;    /* IRQ action list 由中断服务程序构成的单链表队列*/   
  45.     unsigned int        status_use_accessors;  
  46.     unsigned int        core_internal_state__do_not_mess_with_it;  
  47.     unsigned int        depth;      /* nested irq disables */  
  48.     unsigned int        wake_depth; /* nested wake enables */  
  49.     unsigned int        irq_count;  /* For detecting broken IRQs */  
  50.     unsigned long       last_unhandled; /* Aging timer for unhandled count */  
  51.     unsigned int        irqs_unhandled;  
  52.     raw_spinlock_t      lock;  
  53. #ifdef CONFIG_SMP   
  54.     const struct cpumask    *affinity_hint;  
  55.     struct irq_affinity_notify *affinity_notify;  
  56. #ifdef CONFIG_GENERIC_PENDING_IRQ   
  57.     cpumask_var_t       pending_mask;  
  58. #endif   
  59. #endif   
  60.     unsigned long       threads_oneshot;  
  61.     atomic_t        threads_active;  
  62.     wait_queue_head_t       wait_for_threads;  
  63. #ifdef CONFIG_PROC_FS   
  64.     struct proc_dir_entry   *dir;  
  65. #endif   
  66.     const char      *name;  
  67. } ____cacheline_internodealigned_in_smp;  

这个数据结构中的第一字段需要给予特殊的关注,因为这想比于2.4有很大的区别:

  1. struct msi_desc;  
  2.   
  3. /** 
  4.  * struct irq_data - per irq and irq chip data passed down to chip functions 
  5.  * @irq:        interrupt number 
  6.  * @node:       node index useful for balancing 
  7.  * @state_use_accessors: status information for irq chip functions. 
  8.  *          Use accessor functions to deal with it 
  9.  * @chip:       low level interrupt hardware access 
  10.  * @handler_data:   per-IRQ data for the irq_chip methods 
  11.  * @chip_data:      platform-specific per-chip private data for the chip 
  12.  *          methods, to allow shared chip implementations 
  13.  * @msi_desc:       MSI descriptor 
  14.  * @affinity:       IRQ affinity on SMP 
  15.  * 
  16.  * The fields here need to overlay the ones in irq_desc until we 
  17.  * cleaned up the direct references and switched everything over to 
  18.  * irq_data. 
  19.  */  
  20. struct irq_data {  
  21.     unsigned int        irq;  
  22.     unsigned int        node;  
  23.     unsigned int        state_use_accessors;  
  24.     struct irq_chip     *chip;  
  25.     void            *handler_data;  
  26.     void            *chip_data;  
  27.     struct msi_desc     *msi_desc;  
  28. #ifdef CONFIG_SMP   
  29.     cpumask_var_t       affinity;  
  30. #endif   
  31. };  
  • 1
  • 2
  • 3
  • 4
  • 下一页

相关内容