歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> Linux內核 >> Linux內核中斷之中斷請求隊列的初始化

Linux內核中斷之中斷請求隊列的初始化

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

這個數據結構中的第一字段需要給予特殊的關注,因為這想比於2.4有很大的區別:

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