hardirq.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:3k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. #ifndef _ASM_IA64_HARDIRQ_H
  2. #define _ASM_IA64_HARDIRQ_H
  3. /*
  4.  * Copyright (C) 1998-2001 Hewlett-Packard Co
  5.  * Copyright (C) 1998-2001 David Mosberger-Tang <davidm@hpl.hp.com>
  6.  */
  7. #include <linux/config.h>
  8. #include <linux/threads.h>
  9. #include <linux/irq.h>
  10. #include <asm/processor.h>
  11. /*
  12.  * No irq_cpustat_t for IA-64.  The data is held in the per-CPU data structure.
  13.  */
  14. #define softirq_pending(cpu) (cpu_data(cpu)->softirq_pending)
  15. #define ksoftirqd_task(cpu) (cpu_data(cpu)->ksoftirqd)
  16. #define irq_count(cpu) (cpu_data(cpu)->irq_stat.f.irq_count)
  17. #define bh_count(cpu) (cpu_data(cpu)->irq_stat.f.bh_count)
  18. #define syscall_count(cpu) /* unused on IA-64 */
  19. #define nmi_count(cpu) 0
  20. #define local_softirq_pending() (local_cpu_data->softirq_pending)
  21. #define local_ksoftirqd_task() (local_cpu_data->ksoftirqd)
  22. #define really_local_irq_count() (local_cpu_data->irq_stat.f.irq_count) /* XXX fix me */
  23. #define really_local_bh_count() (local_cpu_data->irq_stat.f.bh_count) /* XXX fix me */
  24. #define local_syscall_count() /* unused on IA-64 */
  25. #define local_nmi_count() 0
  26. /*
  27.  * Are we in an interrupt context? Either doing bottom half or hardware interrupt
  28.  * processing?
  29.  */
  30. #define in_interrupt() (local_cpu_data->irq_stat.irq_and_bh_counts != 0)
  31. #define in_irq() (local_cpu_data->irq_stat.f.irq_count != 0)
  32. #ifndef CONFIG_SMP
  33. # define local_hardirq_trylock() (really_local_irq_count() == 0)
  34. # define local_hardirq_endlock() do { } while (0)
  35. # define local_irq_enter(irq) (really_local_irq_count()++)
  36. # define local_irq_exit(irq) (really_local_irq_count()--)
  37. # define synchronize_irq() barrier()
  38. #else
  39. #include <asm/atomic.h>
  40. #include <asm/smp.h>
  41. extern unsigned int global_irq_holder;
  42. extern volatile unsigned long global_irq_lock;
  43. static inline int
  44. irqs_running (void)
  45. {
  46. int i;
  47. for (i = 0; i < smp_num_cpus; i++)
  48. if (irq_count(i))
  49. return 1;
  50. return 0;
  51. }
  52. static inline void
  53. release_irqlock (int cpu)
  54. {
  55. /* if we didn't own the irq lock, just ignore.. */
  56. if (global_irq_holder == cpu) {
  57. global_irq_holder = NO_PROC_ID;
  58. smp_mb__before_clear_bit(); /* need barrier before releasing lock... */
  59. clear_bit(0,&global_irq_lock);
  60.         }
  61. }
  62. static inline void
  63. local_irq_enter (int irq)
  64. {
  65. really_local_irq_count()++;
  66. while (test_bit(0,&global_irq_lock)) {
  67. /* nothing */;
  68. }
  69. }
  70. static inline void
  71. local_irq_exit (int irq)
  72. {
  73. really_local_irq_count()--;
  74. }
  75. static inline int
  76. local_hardirq_trylock (void)
  77. {
  78. return !really_local_irq_count() && !test_bit(0,&global_irq_lock);
  79. }
  80. #define local_hardirq_endlock() do { } while (0)
  81. extern void synchronize_irq (void);
  82. #endif /* CONFIG_SMP */
  83. #endif /* _ASM_IA64_HARDIRQ_H */